diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseInstanceDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseInstanceDAO.java index 4d4459b4812eab5e6f65b2c02710eb4140296627..1f0ea116946e07d0ee4d1d0a4a440d2ebf21e130 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseInstanceDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseInstanceDAO.java @@ -124,7 +124,6 @@ final class DatabaseInstanceDAO extends AbstractDAO implements IDatabaseInstance databaseInstancePE.setUuid(CodeConverter.tryToDatabase(databaseInstancePE.getUuid())); final HibernateTemplate hibernateTemplate = getHibernateTemplate(); hibernateTemplate.update(databaseInstancePE); - hibernateTemplate.flush(); if (operationLog.isInfoEnabled()) { operationLog.info(String.format("UPDATE: database instance '%s'.", databaseInstancePE)); @@ -163,7 +162,5 @@ final class DatabaseInstanceDAO extends AbstractDAO implements IDatabaseInstance databaseInstance.setUuid(UuidUtil.generateUUID()); final HibernateTemplate template = getHibernateTemplate(); template.save(databaseInstance); - template.flush(); - } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GroupDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GroupDAO.java index 15cb44cde1a8b37ffe1225fbdfb12f4c9dd9cceb..d0632b7f67706ae01c4648f7ac5c8f312253cdb7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GroupDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GroupDAO.java @@ -139,7 +139,6 @@ final class GroupDAO extends AbstractDAO implements IGroupDAO group.setCode(CodeConverter.tryToDatabase(group.getCode())); final HibernateTemplate template = getHibernateTemplate(); template.save(group); - template.flush(); if (operationLog.isInfoEnabled()) { operationLog.info(String.format("ADD: group '%s'.", group)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/PersonDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/PersonDAO.java index f0d976584929f2b3beab8bb55197c36d3fe9e136..0d3c50e1a4c0ffe6900ddca3ea3d02768ae66aeb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/PersonDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/PersonDAO.java @@ -68,7 +68,6 @@ public final class PersonDAO extends AbstractDAO implements IPersonDAO final HibernateTemplate template = getHibernateTemplate(); template.save(person); - template.flush(); if (operationLog.isInfoEnabled()) { operationLog.info(String.format("ADD: person '%s'.", person)); @@ -82,7 +81,6 @@ public final class PersonDAO extends AbstractDAO implements IPersonDAO validatePE(person); final HibernateTemplate template = getHibernateTemplate(); template.update(person); - template.flush(); if (operationLog.isInfoEnabled()) { operationLog.info(String.format("UPDATE: person '%s'.", person)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/RoleAssignmentDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/RoleAssignmentDAO.java index cdd9ac9718942293aadd95bde7b6d9aaba8f29d7..2a1c2b0455750c228dec8e116b067fed8bee2964 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/RoleAssignmentDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/RoleAssignmentDAO.java @@ -91,7 +91,6 @@ public final class RoleAssignmentDAO extends AbstractDAO implements IRoleAssignm final HibernateTemplate hibernateTemplate = getHibernateTemplate(); hibernateTemplate.save(roleAssignment); - hibernateTemplate.flush(); if (operationLog.isInfoEnabled()) { operationLog.info(String.format("ADD: role assignment '%s'.", roleAssignment)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java index d4c4f51e6072e6491d8e5df6ae911104e9b5a63b..64a6b196700ed7c5aa31e710894708d7b70c2cc2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java @@ -93,7 +93,6 @@ public class SampleDAO extends AbstractDAO implements ISampleDAO final HibernateTemplate hibernateTemplate = getHibernateTemplate(); hibernateTemplate.save(sample); - hibernateTemplate.flush(); if (operationLog.isInfoEnabled()) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAOTest.java index e8a439f8a17d9dae64c9b62967a3a4444b797cb1..5f62a485095225a5f7f37c0bd2928ea2756b0538 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAOTest.java @@ -25,6 +25,7 @@ import static org.testng.AssertJUnit.fail; import java.util.List; +import org.hibernate.classic.Session; import org.testng.annotations.Test; import ch.systemsx.cisd.openbis.generic.server.business.bo.util.SampleOwner; @@ -74,9 +75,13 @@ public final class SampleDAOTest extends AbstractDAOTest final SamplePE superContainer = createSample(type2, "superContainer", null); well.setContainer(container); container.setContainer(superContainer); - save(superContainer, container, well); // clear session to avoid using samples from first - // level cache - sessionFactory.getCurrentSession().clear(); + save(superContainer, container, well); + + // clear session to avoid using samples from first level cache + Session currentSession = sessionFactory.getCurrentSession(); + currentSession.flush(); + currentSession.clear(); + final List<SamplePE> samples = listSamplesFromHomeDatabase(type3); final SamplePE foundWell = findSample(well, samples); assertTrue(HibernateUtils.isInitialized(foundWell.getContainer()));