13 Filtering data
This chapter covers
- Cascading state transitions
- Listening to and intercepting events
- Auditing and versioning with Hibernate Envers
- Filtering data dynamically
In this chapter, we analyze many different strategies for filtering data as it passes through the Hibernate engine. When Hibernate loads data from the database, we can transparently restrict the data seen by the application with a filter. When Hibernate stores data in the database, we can listen to such an event and execute some secondary routines: for example, write an audit log or assign a tenant identifier to the record.
We explore the following data-filtering features and APIs: