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 Object Relational Mapping and the fly likes Releasing Unit Of Work 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 » Databases » Object Relational Mapping
Bookmark "Releasing Unit Of Work" Watch "Releasing Unit Of Work" New topic
Author

Releasing Unit Of Work

Dhiraj Wagh
Greenhorn

Joined: Feb 10, 2010
Posts: 3
I am using Toplink in my project. While releasing the Unit of Work, we check for the null value. If not null, then we release the unit of work.
But, we do have isActive attribute for UOW, So, shall we check for this attribute before releasing UOW.

Currently, using below one
if (uow != null)
uow.release();

Shall we use this.

if (uow.isActive())
uow.release();
Which approach is correct one...
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
Either is probably ok, but first checking isActive() is more correct.


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Dhiraj Wagh
Greenhorn

Joined: Feb 10, 2010
Posts: 3
Thanks James..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Releasing Unit Of Work