From 4e9266e2d588ae952586c44ae9d95f0788069725 Mon Sep 17 00:00:00 2001 From: Athou Date: Wed, 13 Aug 2014 10:12:18 +0200 Subject: [PATCH] added comment --- src/main/java/com/commafeed/backend/dao/UnitOfWork.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/commafeed/backend/dao/UnitOfWork.java b/src/main/java/com/commafeed/backend/dao/UnitOfWork.java index 4c6e0f33..72be37af 100644 --- a/src/main/java/com/commafeed/backend/dao/UnitOfWork.java +++ b/src/main/java/com/commafeed/backend/dao/UnitOfWork.java @@ -16,6 +16,7 @@ public abstract class UnitOfWork { protected abstract T runInSession() throws Exception; public T run() { + // if newSession is false, we already are in a unit of work and roll back/commit will happen in the wrapping unit of work boolean newSession = !ManagedSessionContext.hasBind(sessionFactory); final Session session = newSession ? sessionFactory.openSession() : sessionFactory.getCurrentSession();