Java Reference
In-Depth Information
APPENDIX D
n n n
Upgrading from Hibernate 2
H ibernate 3 represents a major change from the ways of doing things in Hibernate 2. On the
whole, it is a better product, and we applaud the Hibernate developers for their efforts. One
particular group of users will be made nervous by all the changes: the existing users of Hiber-
nate 2.
Well, there is good news, and there is . . . no bad news! Hibernate 3 has gone the extra mile
to allow earlier users to get along. In this appendix, we will discuss the differences between the
two versions and explain how a Hibernate 2 user can take advantage of them without con-
ducting a major code rewrite.
Hibernate 3 does make changes: the package names have changed, the DTDs have
changed, the required libraries are different, and some of the method names and signatures
have been altered. Even so, we don't think that these differences will cause you much grief
when upgrading to the new version.
You can run Hibernate 3 on a 1.4 or later JVM quite easily. It is possible in principle to run
Hibernate 3 on a 1.3 JVM, although this will require you to recompile it from the source code
and find older versions of some of the libraries that it depends upon.
Once you have read this appendix, we also recommend that you consult the Hibernate 3
Migration Guide in the Documentation section of the Hibernate web site ( http://hibernate.
org ). The Hibernate team maintains and updates this section to reflect users' experiences, so
you can find hints and tips gathered from developers at the cutting edge of just this sort of
upgrade.
Package and DTD Changes
The package names for Hibernate 2 have changed with Hibernate 3. Hibernate 2 used a base
package of net.sf.hibernate , while Hibernate 3 uses a base package of org.hibernate .
This is, in itself, a completely trivial difference—you might imagine that it is purely the
result of a migration from Hibernate's hosting from SourceForge ( http://sf.net or http://
sourceforge.net ) to their own web site ( http://hibernate.org ); but, in fact, there is another
reason for the change.
Because of the package name change, it is possible for an application to use Hibernate 2
and Hibernate 3 simultaneously, allowing legacy Hibernate 2 code to run unmodified within
the same application as more recent Hibernate 3-based components. If the same package
name had been used, then it would be nearly impossible to achieve this.
313
Search WWH ::




Custom Search