-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate 3 and Sub Transactions
PostPosted: Thu Jul 21, 2005 11:18 am 
Newbie

Joined: Thu Jul 21, 2005 10:17 am
Posts: 17
Hibernate version: 3.0.5


Full stack trace of any exception that occurs:
none

Name and version of the database you are using:
MySQL 4.1 and 5.0 with InnoDB Tables using Connection/J 3.1.10a
The generated SQL (show_sql=true):
none

Debug level Hibernate log excerpt:
default



I'm using the session.getCurrentSession() on my EJB Statless Session Beans ...

the code are:

Session hsession = getSessionFactory("ECI").getCurrentSession();
Transaction tx = hsession.beginTransaction();

Eam joe = new Eam();
joe.setAge(12);
hsession.save(joe);

IN THIS POINT I CALL THE ANOTHER METHOD IN THE SAME SESSION
THE CODE OF ANNOTHER METHOD IS:

Session hsession2 = getSessionFactory("ECI").getCurrentSession();
Transaction tx2 = hsession2.beginTransaction();
Eam joe2 = new Eam();
joe2.setAge(32);
hsession2.save(joe2);
tx2.rollback();
hsession2.flush();

BACK TO MAIN METHOD

hsession.flush




In the DATABASE , the firt "joe" are inserted on my database , but on call the another method and call the rollback , the FULL TRANSACTION IS ROLLEDBACK

The Hibernate does not supports a subtransactions ?

I call two timer the begin transaction , only the joe2 made be deleted ,

The InnoDB supports sub-transaction savepoint... the hibernate supports ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 7:39 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Calling the second Session.getTransaction() returned the same transaction, unless the session bean method was marked as 'REQUIERS_NEW'.

Hibernate is transaction independent, it is integrated with underlaying transactions, but all transaction handling should be done by you or container (ejb). Check out org.hibernate.transaction package.


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

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.