Envers 1.2.2 released!

After quite a long break, I’m happy to announce a new release of Envers (available on the downloads page, or via Maven). This is mainly a bugfix release, but there are also new features:

  • possibility to audit relations from audited to non-audited entites. This feature was actually one of the most asked for. You have to explicitly annotate such relations with @Audited(targetAuditMode=NOT_AUDITED). Then, when reading historic versions of your entities, the relation will always point to the “current” version of the entity. This is mainly useful for dictionary-type entities, which never change.
  • new configuration properties: org.hibernate.envers.default_schema and org.hibernate.envers.default_catalog with which you can specify the default catalog/schema for audit tables
  • by default, when you delete an entity, in the audit table only a “marker” entry will be written with all fields null except the id. But if you want, you can now store all data of the entity by specifying the org.hibernate.envers.store_data_at_delete property to true. This is normally not needed as the data is already stored in the last revision before the delete.
  • experimental support for “fake” bidirectional relations, mapped with @OneToMany+@JoinColumn on one side, and @ManyToOne+@Column(insertable=false, updatable=false) on the many side. Envers can now audit such relations without a middle table, but the user has to add an @AuditMappedBy annotation. See the documentation for more details.

Also, all configuration properties were renamed from camel-case to the Hibernate standard, separating words using underscores. But don’t worry, old properties will work also. Moreover, the legacy @Versioned annotations support was removed. If somebody didn’t yet migrate, the transition should be trivial.

This release is fully compatible with Hibernate 3.3, but remember that Envers is now a Hibernate core module, so it will be also included in the coming Hibernate 3.5 release.

For a full list of resolved issues, see the Hibernate JIRA page.

Thanks to Tomasz Bech, Nicolas Rouge and Eugene Goroschenya for providing patches and all other contributors and users for valuable input on the forums and in JIRA! As always, feedback is very welcome.

Envers also has a new homepage; big thanks for the work to Rysiek, Joseph and the JBoss.ORG team!

Merry Christmas!