Merged V3.1 to HEAD

15963: Fix ETHREEOH-1962: Hibernate flush ordering incorrect for alf_qname
   - This merge will come from V3.2 15972 as well, but should not cause issues


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16389 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-20 19:10:08 +00:00
parent db8181d496
commit ed3d9014f0

View File

@@ -172,6 +172,9 @@ public class HibernateQNameDAOImpl extends HibernateDaoSupport implements QNameD
Session session = getSession();
Long id = (Long) session.save(namespace);
DirtySessionMethodInterceptor.flushSession(session, true);
// Force a flush because Hibernate doesn't always get the flush order right
// for DBs that use sequences for the PK: ETHREEOH-1962
DirtySessionMethodInterceptor.flushSession(getSession(), true);
// Cache it
namespaceEntityCache.put(id, namespaceUri);
namespaceEntityCache.put(namespaceUri, id);
@@ -300,6 +303,9 @@ public class HibernateQNameDAOImpl extends HibernateDaoSupport implements QNameD
qnameEntity.setLocalName(localName);
// Persist
Long id = (Long) getSession().save(qnameEntity);
// Force a flush because Hibernate doesn't always get the flush order right
// for DBs that use sequences for the PK: ETHREEOH-1962
DirtySessionMethodInterceptor.flushSession(getSession(), true);
// Update the cache
qnameEntityCache.put(qname, id);
qnameEntityCache.put(id, qname);