This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread 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 Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Releasing Unit Of Work" Watch "Releasing Unit Of Work" New topic

Releasing Unit Of Work

Dhiraj Wagh

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)

Shall we use this.

if (uow.isActive())
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

Joined: Feb 10, 2010
Posts: 3
Thanks James..
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Releasing Unit Of Work
It's not a secret anymore!