Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Detach Before Transaction Completes

 
Josh Britton
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Josh,
Welcome to JavaRanch!

Both Hibernate and EJB 3 are ORM frameworks. So I'll move this to our ORM forum for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic