-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Java Hibernate Cookbook
By :
As we know, in the hibernate persistent lifecycle, a particular object travels from state to state, from transient, persistent, to detached. During processing, it may commit or roll back before it reaches the last state. Sometimes, we need to perform some additional tasks such as cleanup, log or some operations on the object between different states of the persistent life cycle. To perform such activities, hibernate provides a useful and pluggable feature called interceptor.
Interceptor, as the name suggests, is used to intercept any operation. Interceptors apply hooks inside the logic. In hibernate, we have some built-in interceptors that help us intercept our logic.
Generally, an interceptor is used to log monitor data that is input and to validate it. You can also change or overwrite it at runtime. Let's take a look at the next example.
In this recipe, we will discuss the use of a basic interceptor and some methods of intercepting. Here, we will try...
Change the font size
Change margin width
Change background colour