wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Detach Before Transaction Completes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Detach Before Transaction Completes" Watch "Detach Before Transaction Completes" New topic
Author

Detach Before Transaction Completes

Josh Britton
Greenhorn

Joined: Nov 26, 2008
Posts: 24
First, I'm really not sure what the best forum is for this question, so I apologize in advance if this is the wrong place.

My situation: I use Hibernate with EJB3, and I use the default transaction behavior. So my transactions last for my whole methods. However, sometimes I want to 'detach' a persistent object before a method completes. There have been several occasions where this seemed useful. Today it's because I get an object using LockMode_UPGRADE at the beginning of a method, then make a small change to the object, then perform the rest of a long method. I no longer need a lock on the object's row during the rest of the method, but I don't know how to release the lock except when the container automatically completes the transaction. Any ideas?

Thanks,

Josh
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30076
    
149

Josh,
Welcome to JavaRanch!

Both Hibernate and EJB 3 are ORM frameworks. So I'll move this to our ORM forum for you.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
wood burning stoves
 
subject: Detach Before Transaction Completes
 
Similar Threads
KnB notify(), wait(), synchronized block
Message-driven beans and transaction attributes
Transaction End limit in case of CMT
detach hibernate objects
Doubt in one question