Development of Hibernate4 is well under way, with the Alpha2 version released recently. It contains one major improvement which is quite significant for Envers, namely Integrators (see HHH-5562 & HHH-6081).
Using this mechanism it will no longer be necessary to add the 6 event listeners to your Hibernate configuration – all that is needed for Envers to work is to put it on the classpath! If any of your entities are annotated with @Audited
, they will get audited automatically (any changes will be written to the history tables).
It is of course possible to turn off the automatic registration, as well as write your own integrators, which automatically register custom event listeners. The integrators are discovered using java’s service loader, by the presence of a META-INF/services/org.hibernate.spi.Integrator
file in the jar, which should contain the name of the class implementing the integration functionality.
Adam
comments powered by Disqus