3.2.2.7. Migrate Your Hibernate 3.5.x Application to Hibernate 4.x
Procedure 3.15.
Merge the AnnotationConfiguration into the Configuration
AlthoughAnnotationConfiguration
is now deprecated, it should not affect your migration.If you are still using anhbm.xml
file, you should be aware that JBoss Enterprise Application Platform 6 now uses theorg.hibernate.cfg.EJB3NamingStrategy
inAnnotationConfiguration
instead of theorg.hibernate.cfg.DefaultNamingStrategy
that was used in previous releases. This can result in naming mismatches. If you rely on the naming strategy to default the name of an association (many-to-many and collections of elements) table, you may see this issue. To resolve it, you can tell Hibernate to use the legacyorg.hibernate.cfg.DefaultNamingStrategy
by callingConfiguration#setNamingStrategy
and passing itorg.hibernate.cfg.DefaultNamingStrategy#INSTANCE
.Modify the namespaces to conform to the new Hibernate DTD file names.
Table 3.5.
Previous DTD Namespace New DTD Namespace http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd Modify environment variables
- If you are using Oracle and using the
materialized_clob
ormaterialized_blob
properties, the global environment variablehibernate.jdbc.use_streams_for_binary
must be set to true. - If you are using PostgreSQL and using the
CLOB
orBLOB
properties, the global environment variablehibernate.jdbc.use_streams_for_binary
must be set to false.