aspose file tools*
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 Soft Skills this week in the Jobs Discussion 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