Author: julien(a)jboss.com
Date: 2007-07-16 12:03:21 -0400 (Mon, 16 Jul 2007)
New Revision: 7784
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
Log:
avoid usage of hibernate natural id cache as it is not implemented properly
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2007-07-16
15:52:27 UTC (rev 7783)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2007-07-16
16:03:21 UTC (rev 7784)
@@ -23,11 +23,9 @@
package org.jboss.portal.core.impl.model.portal;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
-import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
-import org.hibernate.criterion.Restrictions;
import org.jboss.logging.Logger;
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
import org.jboss.portal.core.model.portal.PortalObjectId;
@@ -48,6 +46,9 @@
/** The query for lookup when the path is null. */
private static final String LOOKUP_QUERY_FOR_ROOT = "from ObjectNode where
path=:path or path is null";
+ /** The query for lookup when the path is null. */
+ private static final String LOOKUP_QUERY = "from ObjectNode where
path=:path";
+
/** . */
private static Logger log = Logger.getLogger(PersistentPortalObjectContainer.class);
@@ -245,27 +246,23 @@
{
Object result;
+ //
+ String queryString = LOOKUP_QUERY;
+
// We need to lookup the root of the empty namespace with a special query in order
to fix
// oracle weird behavior with zero length strings considered as null value
if (id.getPath().getLength() == 0 && id.getNamespace().length() == 0)
{
- String queryString = LOOKUP_QUERY_FOR_ROOT;
- Query query = session.createQuery(queryString);
- query.setParameter("path", id);
- query.setCacheable(true);
-
- // Unique result will return null if no object is found
- result = query.uniqueResult();
+ queryString = LOOKUP_QUERY_FOR_ROOT;
}
- else
- {
- Criteria criteria = session.createCriteria(ObjectNode.class);
- criteria.add(Restrictions.naturalId().set("path", id));
- criteria.setCacheable(true);
- // Unique result will return null if no object is found
- result = criteria.uniqueResult();
- }
+ //
+ Query query = session.createQuery(queryString);
+ query.setParameter("path", id);
+
+ // Unique result will return null if no object is found
+ result = query.uniqueResult();
+
return (ObjectNode)result;
}