[hibernate-dev] Hibernate5 migration

Koen Serneels ks at error.be
Wed Aug 12 16:21:59 EDT 2015


Hi,

 

I'm migrating from Hibernate4 to 5(RC4). While doing so I'm stumbling on
some stuff that has been removed or moved.

 

- In Hibernate4 we modified mappings on-the-fly by overriding Spring's
LocalSessionFactoryBean#buildSessionFactory.

Doing so we could first access the getClassMapping on
org.hibernate.cfg.Configuration before letting the SF actually build.

However, in Hibernate5 the metadata access has been refactored and is no
longer part of the Configuration. Should we use MetadataContributor instead
for these purposes?

 

- Is there a way to register MetadataContributor dynamically? I see that it
is being loaded using Java's ServiceLoader.

However, I need some programmatic API access to enable or disable the
Contributor (for example based on Spring profiles).

 

- For JTA integration we were using
org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory, but
this class is no longer present. 

Also in org.hibernate.cfg.AvailableSettings the key that was used
(hibernate.transaction.factory_class) to configure the factory is also
removed. 

Is hibernate.transaction.coordinator_class the new key we should be using
instead with
org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordi
natorImpl as value for JTA? 

Do we need to configure anything special in case of resource local TX or is
JdbcResourceLocalTransactionCoordinatorImpl the default?

 

- generateDropSchemaScript and generateSchemaCreationScript have been
removed from Configuration. Is there a way to access this in another way?

 

Thanks

 

Koen.

 



More information about the hibernate-dev mailing list