Envers Joins Hibernate
Envers is an open-source project from JBoss which aims to provide easy versioning of persistent JPA classes. InfoQ provided information about the first GA release, 1.0.0, back in July of 2008. Since then Envers 1.1.0 was released which provided several new features.
The primary focus for the 1.1.0 release was the addition of support for persistent collections. Adam Warski, founder of Envers, described the new feature:
You can now version any relation, collections of “simple” types, maps, etc. All collection mappings defined by JPA are now supported, and most of what Hibernate additionally allows also.
The latest release also included some other improvements and bug fixes, as well as updates to the demos. With the continuing improvements to Envers, there is other news which was the source for this news item. On October 30, 2008 Envers officially became a module of Hibernate. The Envers website, documentation and forum will stay at there original home page for some time to come. The primary major changes were listed by Adam Warski on his blog:
- The code is now in the hibernate-core repository (envers module). There will be no more commits to the old repository.
- Issue tracking moved to Hibernate’s JIRA. All open issues from the old JIRA have been moved there.
- Envers is now built using maven2, which replaces the old ant build
It's exciting times for Adam Warski and other contributors to Envers. The move to the Hibernate family should aid in the continued development of the Envers module and the further expansion into developers toolbelts when it comes to persisting Java objects.
How does envers handle circular references?
by
peter lin
Person - has a collection of addresses
Address - has a reference to the person
How does envers know to skip a bidirectional reference and only traverse down the object graph and not back up.
Re: How does envers handle circular references?
by
Adam Warski
When loading changes, there is a "first-level cache", so you always attempt to load each entity at a revision once.
Hope this answers your question :)
Adam
Re: How does envers handle circular references?
by
peter lin
It sounds like the @versioned annotation gives users the ability to set the depth. I have another question, which I couldn't figure out from the website or forum.
Say I have a large object graph and all the entities in that graph are versioned. Here is a hypothetical model.
plan
- Customer
- list of addresses
- PlanDetails
- list of services
- PlanRegion
- list of region restrictions
- PlanRestriction
- PlanOptions
- list of optios the customer has
- PlanOption
- ServiceHistory
- list of service calls
- ServiceCall
If I add a new ServiceCall, does it revision the entire graph in the global revision, or does it maintain a parts list?
thanks
peter
Re: How does envers handle circular references?
by
Adam Warski
no, only a new revision for ServiceCall will be generated. If the relation with ServiceHistory is bidirectional, and a certain configuation option is set, a revision for ServiceHistory will also be generated.
--
Adam
Re: How does envers handle circular references?
by
peter lin
thanks
peter
Educational Content
Java Garbage Collection Distilled
Martin Thompson Jun 17, 2013
C++11 The Future is Here
Bjarne Stroustrup Jun 16, 2013
The Big Data Revolution
Claudia Perlich Jun 16, 2013
Engines of Abstraction
Jim Duey Jun 13, 2013
Behavior-driven Development
Liz Keogh Jun 13, 2013




Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think