From ca74597b5fde42fee1ea1fdee29329e7fb5341bb Mon Sep 17 00:00:00 2001
From: jakubs <jakubs>
Date: Thu, 23 Aug 2012 15:23:09 +0000
Subject: [PATCH] BIS-153 SP-257 fix a bug in HibernateInterceprotsWrapper

SVN: 26442
---
 .../dataaccess/HibernateInterceptorsWrapper.java   | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/HibernateInterceptorsWrapper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/HibernateInterceptorsWrapper.java
index f333cc599d3..06c8b11a206 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/HibernateInterceptorsWrapper.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/HibernateInterceptorsWrapper.java
@@ -22,8 +22,8 @@ import org.hibernate.EmptyInterceptor;
 import org.hibernate.Transaction;
 import org.hibernate.type.Type;
 
-import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.EntityVerificationInterceptor;
 import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.DynamicPropertiesInterceptor;
+import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.EntityVerificationInterceptor;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder;
 
 /**
@@ -54,8 +54,8 @@ public class HibernateInterceptorsWrapper extends EmptyInterceptor implements Se
     public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState,
             Object[] previousState, String[] propertyNames, Type[] types)
     {
-        dynamicPropertiesInterceptor.onFlushDirty(entity, id, currentState, previousState, propertyNames,
-                types);
+        dynamicPropertiesInterceptor.onFlushDirty(entity, id, currentState, previousState,
+                propertyNames, types);
         entityVerificationInterceptor.onFlushDirty(entity, id, currentState, previousState,
                 propertyNames, types);
         return false;
@@ -70,11 +70,17 @@ public class HibernateInterceptorsWrapper extends EmptyInterceptor implements Se
         return false;
     }
 
+    // This method is only overriden in dynamic property interceptor
     @Override
     public void afterTransactionCompletion(Transaction tx)
     {
         dynamicPropertiesInterceptor.afterTransactionCompletion(tx);
-        entityVerificationInterceptor.afterTransactionCompletion(tx);
     }
 
+    // This method is only overriden in entity verification interceptor
+    @Override
+    public void beforeTransactionCompletion(Transaction tx)
+    {
+        entityVerificationInterceptor.beforeTransactionCompletion(tx);
+    }
 }
-- 
GitLab