-->
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: Using Hibernate with BMT and CMT
PostPosted: Sat Oct 07, 2006 7:52 am 
Newbie

Joined: Tue Mar 21, 2006 7:18 pm
Posts: 13
Hi,

I have a question on using hibernate in both BMT and CMT at the same time.

By now I have a CMT stateles session bean. In it I have methods which I want to be executed in a transaction. So CMT works fine for that.

But in this session bean I have a getObejct() methd and a updateObject() method.

When I want to update an object I read this object within one transaction but update it in an other. This can lead to lost update issues.

Now I want use a BMT UserTransaction to put this both methods in one transaction.

Since my methods have the CMT transaction-type="Required" they will be called by the UserTransaction and won't start new transactions.

It looks like this:
Code:
UserTransaction tx = ... ;
tx.begin();
   service.getObject();

   //change some attributes

   service.updateObject();
tx.commit();


As I use CMT I just use sessionFactory.currentSession(); in the CMT methods

Can still use this, if I do it the way above?

Do I need to confiruge something special for this? I'm using JBoss.

Best regard,
Jakob


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 9:39 am 
Newbie

Joined: Tue Mar 21, 2006 7:18 pm
Posts: 13
nobody knows that?


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.