-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate and Transactions
PostPosted: Tue Feb 20, 2007 9:34 am 
Beginner
Beginner

Joined: Wed Jan 31, 2007 11:39 am
Posts: 24
I would like to ask some questions about session and transactions in Hibernate.

I have a simple web application that uses Hibernate 3.1 and Tomcat 5.0 and an hsqldb database.
In my hibernate.cfg.xml I have added the following lines:

<property name="connection.datasource">java:comp/env/jdbc/TestDB</property>
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.JOTMTransactionManagerLookup</property>
<property name="transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory</property>


Since I added the JTA does this mean that my JOTMTransaction manager will take care of the transactions with the database?
Or in order to do that I have to use Session Beans and a J2EE application server that will offer me managed transactions? Basically I cannot clearly
understand what JTA will offer me if I do not use an application server such as JBOSS that offers managed transactions.

What brought me in this questions is that I had a simple getSomething() method:

Session session = HibernateUtil.getSession();
session.beginTransaction();
List result = session.createQuery("from Event").list();
session.getTransaction().commit();



that worked fine and when I added the JTA code the method works if I remove the session.beginTransaction(); and the session.getTransaction().commit();

Any explanations? Thanking you in advance...
[/b]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.