Home > Persistence > The JTA manager lookup in Hibernate 4/AS7

The JTA manager lookup in Hibernate 4/AS7

I’m waiting for eclipse to start up again, so I’ll post a quick note about the JTA manager lookup mechanism that’s changed in Hibernate 4 and AS7.

Those of you who’ve read the How do I migrate my application from AS5 or AS6 to AS7 guide on the Jboss AS 7 documentation site have probably come across the following quote:

Configure the datasource for Hibernate or JPA

If your application uses JPA and currently bundles the Hibernate JARs, you may want to use the Hibernate that is included with AS7. You should remove the Hibernate jars from your application. You should also remove the “hibernate.transaction.manager_lookup_class” property from your persistence.xml as this is not needed.

Unfortunately, while you may not need the hibernate.transaction.manager_lookup_class property, you do need a property apparently.

If you don’t set any property (with regards to a JTA transaction manager), you’ll end up getting a stack trace that looks like this:

java.lang.NullPointerException
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:73)
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:115)
at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149)
at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1208)

If you even go as far as googling the above stack trace, you’ll run into HHH-7109, which then mentions the hibernate.transaction.jta.platform. Oh, except that it’s a new, undocumented property”. Great..

Ah ha! But there is actually documentation for this! It can be found in the developer guide, specifically, here.

There is in fact, a whole chapter on transactions, for developers, here.

Advertisements
Categories: Persistence
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: