O'Reilly logo

Mastering Hibernate by Ramin Rad

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Interceptors

Interceptors work similarly to events, they enable you to inject call back operations when interacting with the session. Creating and using interceptors is simpler than events. Furthermore, you can enable interceptors on a specific session, whereas events are registered globally and will apply to all sessions. But you can also enable an interceptor on a session factory, so it applies to all sessions.

Hibernate defines an interface called org.hibernate.Interceptor that you would need to implement. But, it also provides an empty implementation that you can extend so that you won't need to implement every method of the interface.

Most of the call back methods on Interceptor return a Boolean data type to indicate whether the method has ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required