File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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..
I agree. Here's the link:
subject: Releasing Unit Of Work
It's not a secret anymore!