Summary

In this chapter, we discussed Java's SPI and OSGi model. This was necessary in order to understand the event architecture. As we saw, event listeners can be registered as services to respond to certain actions that take place in the persistence context. This sophisticated architecture empowers Hibernate to be pluggable and enables runtime environments to act as service providers.

We also discussed interceptors, which offer capability similar to events, but they are easier to create and use. The simplicity of interceptors is due to their lacking the sophisticated architecture that is used by events. For this reason, they are less modular and pluggable.

Finally, we looked at envers, which enable entity versioning and audit mechanisms. We showed that it's simple to start tracking entity revisions. But browsing through the revisions requires a bit of coding. Luckily, Hibernate envers offers a rich API to make that easy as well.

Envers uses the same event architecture that we discussed, and it is registered as a pluggable service. So, you can override it and create your own revision mechanism provided by the concepts in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.54.136