Starting with version 3.5 (currently CR2), Hibernate Annotations 3.x and Hibernate EntityManager projects have been merged into the Hibernate Core codebase as invidual modules. As a surprising addition, Hibernate Envers subproject is added as well (that’s a great thing as you get Auditing, out of box hereafter). So if you’re stuck with Hibernate 3.3.x and would like to try the almost final release, what do you need to do?
Unfortunately, the JBoss folks won’t tell you since they are very busy rebranding, redesigning their websites for the past couple of years (and it’s still so fragmented, I wonder why they just can’t hire a UI designer and a Content Manager. Talk about narcissist JEE programmers). Anyways, I wanted to try the new distribution since it’s getting close to the final release and it implements JPA 2. In case you’ve missed the boat, this is a good place to find out what’s new in JPA 2.
I tried the brute force method first: replace all 3.3.x jars with 3.5 CR2 jars.
Before: 7 jars
After: 2 jars
hibernate3.jar — download from hibernate.org
Now, that’s a good sign. And all other optional and required dependencies (jta, javaassist, swarmcache,c3po, all other cache jars) haven’t changed.
But wait, where can you download javax.persistence.jar? Isn’t that supposed to be ejb3.1-persistence.jar? I’m not sure either. What I’m sure is this: There is no direct download link for the JPA2 api jar anywhere. Try it. Mail me if you find it.
I downloaded an entire GlassFish 3 distribution (JEE 6 reference implementation along with JPA 2) instead. And copied the javax.persistence.jar from its modules folder, instead. So in summary, I replaced the 7 jars with these 2 jars and does it work?
So, far my existing applications haven’t broken. The tests seems fine. And looks like the migration did work. Impressive.