-->
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.  [ 4 posts ] 
Author Message
 Post subject: Transaction did not roll back when exception raised
PostPosted: Sun Jan 01, 2006 7:18 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
I have some session beans that use EntityManager to manage entity beans that use annotations for persistences(hibernate).

I did not add any annotations for transactions. Its default is required. During processing one HTTP request, a number of session bean methods of different beans are called to insert entities into DB (MySQL) using
em.persist(entity)
but one method throwed an DB exception (duplicate ID). I expected the whole transaction to be rolled back. But it did not, leaving the data inconsistent.

Are the EMs from different session beans the same entity manager? they are injected using the same annotation
@PersistenceContext (unitName="pc")
Are all the session bean methods called during one HTTP request belonging to one Hibernate session, one transaction?
Do you need to add any transaction annotation to the session bean methods? what I need is that the all methods during one HTTP request belong to one transaction. Is the default sufficient?

Thanks.
Dave


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 6:17 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
A transactional persistence context is associated to the JTA transaction boundary.
An extended persistence context is associated to the SFSB lifetime.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 8:59 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
emmanuel wrote:
A transactional persistence context is associated to the JTA transaction boundary.
An extended persistence context is associated to the SFSB lifetime.


Hi Emmanuel,

I am not familiar with JTA/SFSB. Could you explain what I need to do to enforce all session bean methods to be in one transaction during one HTTP request? or point me to the some docs? Thank you very much.

Happy new year!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 10:48 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't have any doc ref, you'll have to google them

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.