This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes How to commit the hibernate based transaction through a statless session bean's transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to commit the hibernate based transaction through a statless session bean Watch "How to commit the hibernate based transaction through a statless session bean New topic
Author

How to commit the hibernate based transaction through a statless session bean's transaction

Barnabas Jeremiah
Greenhorn

Joined: Jul 05, 2012
Posts: 26

Dear Friends,
I am new to Hibernate..... I am using Hibernate Queries inside my Stateless Session Bean's Business logic...
But the Session Bean's Transaction commit or rollback will not be visible to the hibernate's Transaction other than it's own transaction.. how to make these two transactions visible to each other... so that using my Session bean's Transaction's commit if no errors would save the hibernate's Transaction.....
.... if I would have asked any wrong cos my less knowledge pardon me and kindly reply me...
thanks in Advance
Barnabas Jerry...


Thanks with warm regards,
Barnabas Jeremiah
lokesh sree
Ranch Hand

Joined: Oct 27, 2009
Posts: 99

It could be because your transaction isolation is set to read committed. which means changes made in one transaction(tx1) will be visible to another transaction(tx2) only if tx2 reads the data after tx1 has committed the changes.
If you want the changes in both the txs to be visible to both, you will need to use tx isolation of "read uncommitted".
You can start by reading the details here http://en.wikipedia.org/wiki/Isolation_(database_systems)
Hope that helps.


Lokesh
( SCBCD 5, CCENT, SCJP 5 )
Barnabas Jeremiah
Greenhorn

Joined: Jul 05, 2012
Posts: 26

Thanks lokesh..... but who i can merge these ejb session as well as the hibernate session in one...? i want my ejb session should be applicable to the hibernate's session.. so when the program executes with out error the ejb session will commit the transaction...
lokesh sree
Ranch Hand

Joined: Oct 27, 2009
Posts: 99

ohh.. ok. I have misunderstood your question. I thought you were speaking about parallel transactions and hence provided info about tx isolation.
I do not have much idea about hibernate specific txs.
Normally in case of JEE(EJBs using JPA), with Container Managed Transaction management(CMT), the txs of the EJBs will take care of the tx success/failure of the JPA/db calls as well.
i.e, the tx of the ejb session will commit only if the db call made using jpa succeeds.
But i am not sure what you meant by hibernate tx. You can provide some additional details and see if some one else can help you.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to commit the hibernate based transaction through a statless session bean's transaction