Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate JTA transaction: Failed to instantiate TransactionFactory

 
Paul W Lee
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,

I'm using hibernate 2.0 and JTATransaction as transaction strategy, and the underlying database is oracle 9.

In the hibernate.cfg.xml:
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">false</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransaction</property>
<property name="connection.username">username</property>
<property name="connection.url">jdbc : oracle : thin: @ ip : port : sid</property>
<property name="connection.password">password</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>

There is this error:
06:09:43,984 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransaction
06:09:44,000 ERROR [TransactionFactoryFactory] Failed to instantiate TransactionFactory
java.lang.InstantiationException: net.sf.hibernate.transaction.JTATransaction

Quite confused what happens, and how to heal it?

Thanks!


Paul

[ April 13, 2005: Message edited by: Paul W Lee ]
[ April 13, 2005: Message edited by: Paul W Lee ]
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not a hibernate expert, but from my understanding the JTATransaction should be JTATransactionFactory. Also you should be fine by not even having that line there. Hibernate will use the default JDBCTransactionFactory that is fine as long as you are not using mulitple data sources. From what I've read the JTA Transactions actually come with more overhead that you just don't need if you are using a single db.
 
Paul W Lee
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steven,

Thank you for your reply.

Actually, i'm quite new to hibernate, and not yet clear for some basice concepts. The first problem is how to execute database operations using hibernate.

According to my understanding, there are 2 (or 3) ways to connect to database: one is to use JDBC connection pool; the other is JTA transaction. The project is under development and it seems difficult to do unit test if using JDBC connection pool because every time it has to deploy java classes on weblogic (or other web server).

Do you think my idea is correct?




Regards,

Paul
[ April 13, 2005: Message edited by: Paul W Lee ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic