-->
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.  [ 7 posts ] 
Author Message
 Post subject: SessionBean CMT with Hibernate
PostPosted: Fri Dec 09, 2005 4:05 am 
Newbie

Joined: Sat Dec 03, 2005 5:36 am
Posts: 5
Hello ,

I am running WL8.1SP3 with hibernate 3.05 and I am facing this issue:

I call a method tx marked "requiredNew" on a sessionBean SB1

From SB1, I call a method on a SB2 tx marked "required": From this method I use the getCurrentSession and insert an object and flush.

After rmethod returned , from SB1, I call now a method on a SB2 tx marked "required" where I select the object I just inserted previously but without any result ....
why ???? :(

When SB1 method return, I can see the row added because tx get commited but from SB1 method, i am still in the same JTA transaction context , where I should be able to see all the changes. Is my assumption true?

I check out the JTA weblogic console where i see that only one tx has been opened and commit, does it means that even if there is one JTA tx, you can have mulitple database tx ?


help please!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 09, 2005 11:55 am 
Newbie

Joined: Mon Jul 18, 2005 10:15 am
Posts: 17
The transaction with SB1 is not committed yet and depending your TX dirty (isolation) level setting, you might NOT be able to see the data which is not committed.

If you really need that piece of data, you have it in memory. So why do you have to do a Select?

HTH.
JB


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 09, 2005 1:04 pm 
Newbie

Joined: Sat Dec 03, 2005 5:36 am
Posts: 5
The default tx mode of my oracle server is:

TRANSACTION_READ_COMMITTED—The transaction can view only committed updates from other transactions

Thus, I should be enable to see my own change...

The reason why I am doing this is I am doing Unit Tesing, I want to do some assertion.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 09, 2005 5:13 pm 
Newbie

Joined: Mon Jul 18, 2005 10:15 am
Posts: 17
a) Session.flush() is NOT to commit the changes.
b) m1() will only able to see comitted changes as you understand.
c) Your
SB1.m1() - requiredNew and
SB2.m2() - required
are actually in the SAME transaction.
d) Before m1() ends (== before the TX is committed), m1() will not be able to see the changes made by m2().

HTH,
JB


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 10, 2005 4:38 am 
Newbie

Joined: Sat Dec 03, 2005 5:36 am
Posts: 5
SB1::m1() requiredNew
|
+-----SB2::m1() required { Insert / flush }
|
+-----SB2::m2() required { select inserted data}


If I understand, for you there is one db tx associated with each method. Commit of each tx is ordered only by the top most caller , is this true ?

thx


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 10, 2005 8:42 am 
Beginner
Beginner

Joined: Thu Dec 01, 2005 7:07 pm
Posts: 21
When the transaction is let to be managed by the container, the transaction is commited at the end of the method call. The whole txn might get commited only at the end of sb1::m1. Try if you could see the data thru sqlplus at the end of sb2::m1 and sb2::m2.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 10, 2005 2:29 pm 
Newbie

Joined: Sat Dec 03, 2005 5:36 am
Posts: 5
ISolation level read commited means other see only commited data. Owner of the transaction see any of his change this is obvious.

I should be enabled to see modified data, unless I miss something in EJB tx management. I must have an issue somewhere in hibernate, because I added a delete command in a m3 method that delete what I inserted priviously and flush. Hiberante issued the delete whithout constraint exception. But when m2 execute it retrieved the deleted rows :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.