Greetings,
 supplied patch will update the OJB usage pattern from direct Query construction
with operator new to use the IdentityFactory and retrieval of object by OJB 
Identity
(which is also more deterministic than retrieval by Query/Criteria).

This should improve the OJBStore and resolve one of the outstanding
Gump integration issues with Slide.

Regards,
 Martin
Index: 
src/stores/org/apache/slide/store/ojb/property/ElementListPropertyHandler.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-slide/src/stores/org/apache/slide/store/ojb/property/ElementListPropertyHandler.java,v
retrieving revision 1.2
diff -u -r1.2 ElementListPropertyHandler.java
--- 
src/stores/org/apache/slide/store/ojb/property/ElementListPropertyHandler.java  
    23 Jan 2005 13:57:27 -0000      1.2
+++ 
src/stores/org/apache/slide/store/ojb/property/ElementListPropertyHandler.java  
    14 Apr 2005 13:37:54 -0000
@@ -5,7 +5,7 @@
  *
  * ====================================================================
  *
- * Copyright 1999-2002 The Apache Software Foundation
+ * Copyright 1999-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,26 +22,31 @@
  */
 package org.apache.slide.store.ojb.property;
 
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.ojb.broker.Identity;
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.PersistenceBrokerException;
-import org.apache.ojb.broker.query.*;
+import org.apache.ojb.broker.query.Criteria;
+import org.apache.ojb.broker.query.Query;
+import org.apache.ojb.broker.query.QueryByCriteria;
+import org.apache.ojb.broker.query.QueryFactory;
+import org.apache.slide.common.Domain;
 import org.apache.slide.content.NodeProperty;
 import org.apache.slide.store.ojb.peer.PropertyPeer;
 import org.apache.slide.store.ojb.peer.PropertyValuePeer;
 import org.apache.slide.util.logger.Logger;
-import org.apache.slide.common.Domain;
 import org.jdom.Document;
 import org.jdom.Element;
-import org.jdom.Namespace;
 import org.jdom.JDOMException;
+import org.jdom.Namespace;
 import org.jdom.input.SAXBuilder;
-import java.util.List;
-import java.util.Iterator;
-import java.io.IOException;
-import java.io.StringReader;
 
 /**
- * A handler for lists of XML elements. 
+ * A handler for lists of XML elements.
  * It stores the contents of each element in separate rows in the 
property_values table.
  */
 public class ElementListPropertyHandler implements PropertyHandler {
@@ -126,11 +131,12 @@
                     value += "/>";
                     propertyPeer.setValue(value);
                     broker.store(propertyPeer);
-                    QueryByCriteria query = new QueryByCriteria(propertyPeer);
-                    propertyPeer = 
(PropertyPeer)broker.getObjectByQuery(query);
-                    if ( propertyPeer == null )
+                    final Identity propertyPeerOid = 
broker.serviceIdentity().buildIdentity(propertyPeer);
+                    propertyPeer = (PropertyPeer) 
broker.getObjectByIdentity(propertyPeerOid);
+                    if (propertyPeer == null) {
                         throw new PropertyHandlerException("Could not retrieve 
stored property: " + property.getNamespace() + ":" + property.getName());
-                }   
+                    }
+                }
                 PropertyValuePeer propertyValue = new PropertyValuePeer();
                 propertyValue.setPropertyId(propertyPeer.getPropertyId());
                 propertyValue.setValueId(valueId);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to