• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate 2 to Hibernate 3 migration

 
John Molitor
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any gotcha's, tips, or tricks?
 
Nick Heudecker
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I migrated, I had some issues with the new query parser, so I configured Hibernate to use the classic parser.

Make sure you copy all of the new jars over, and run a sed script on your code tree (including config and properties files) to replace the package names.

I think that's all that tripped me up. The Hibernate 3 migration guide can be found here: http://www.hibernate.org/250.html
 
Patrick Peak
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, if you are using Spring's HibernateTemplate (which I have done in some of my projects) you need to change their packages to use the new Hibernate 3 classes. The old Hibernate 2.1 is covered in

org.springframework.orm.hibernate

while the new stuff is in

org.springframework.orm.hibernate3

This means there are 2 HibernateTemplate classes

org.springframework.orm.hibernate.HibernateTemplate
org.springframework.orm.hibernate3.HibernateTemplate

So don't just blindly autoimport (in IDEA for example) without checking the packages first.
 
Dave Salter
Ranch Hand
Posts: 293
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've migrated a fairly simple app from H2 to H3 and didn't really have any problems. The most difficult part was probably finding out exactly what jars to use.

Most of the books I have seen (Hibernate in Action in particular) only cover H2, however I found that the majority of it is atill applicable to H3.
 
John Molitor
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the responses everyone.
 
Billy Tsai
Ranch Hand
Posts: 1304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so the hibernate 2 to 3 migration guide is suitable for any databases?
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.hibernate.org/250.html
http://www.hibernate.org/250.html#A23

Looks like 2.1 and 3.0 are not compatible
 
Dave Salter
Ranch Hand
Posts: 293
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate 3 is not a "drop-in" replacement for Hibernate 2, so in that sense they are not compatible.

The migration guide mentioned above by Nick included details of how to convert from H2 to H3 though.

Depending upon what features you have used, you may find migration straightforward or a little more complex.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic