incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r1167584 - in /incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql: sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/ sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/ sql-impl/src/ma...
Date Sat, 10 Sep 2011 19:51:41 GMT
Author: kevin
Date: Sat Sep 10 19:51:40 2011
New Revision: 1167584

URL: http://svn.apache.org/viewvc?rev=1167584&view=rev
Log:
ISIS-121: Updated the Automapper to support saving collections directly, and improved the
structure of the collection UPDATE command to use a single "WHERE PK_ID IN (x,x,x,x,x)" command
instead of multiple "WHERE PK_ID = x" commands.

Modified:
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/ObjectMapping.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlObjectStore.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/CombinedCollectionMapper.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/AbstractJdbcMultiFieldMapping.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java?rev=1167584&r1=1167583&r2=1167584&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java
Sat Sep 10 19:51:40 2011
@@ -41,8 +41,13 @@ public class IdMappingAbstract {
 
     public void appendWhereClause(final DatabaseConnector connector, final StringBuffer sql,
final Oid oid) {
         sql.append(column);
+        sql.append(" = ");
+        appendObjectId(connector, sql, oid);
+    }
+
+    public void appendObjectId(final DatabaseConnector connector, final StringBuffer sql,
final Oid oid) {
+        sql.append("?");
         connector.addToQueryValues(primaryKeyAsObject(oid));
-        sql.append(" = ?");
     }
 
     public void appendCreateColumnDefinitions(final StringBuffer sql) {
@@ -65,7 +70,8 @@ public class IdMappingAbstract {
         if (object == null) {
             sql.append("NULL");
         } else {
-            sql.append(connector.addToQueryValues(primaryKeyAsObject(object.getOid())));
+            appendObjectId(connector, sql, object.getOid());
+            // sql.append(connector.addToQueryValues(primaryKeyAsObject(object.getOid())));
         }
     }
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/ObjectMapping.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/ObjectMapping.java?rev=1167584&r1=1167583&r2=1167584&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/ObjectMapping.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/ObjectMapping.java
Sat Sep 10 19:51:40 2011
@@ -53,4 +53,6 @@ public interface ObjectMapping {
 
     void startup(DatabaseConnector connection, ObjectMappingLookup objectMapperLookup);
 
+    boolean saveCollection(DatabaseConnector connection, ObjectAdapter parent, String fieldName);
+
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlObjectStore.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlObjectStore.java?rev=1167584&r1=1167583&r2=1167584&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlObjectStore.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlObjectStore.java
Sat Sep 10 19:51:40 2011
@@ -29,6 +29,7 @@ import org.apache.isis.core.commons.debu
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
@@ -115,15 +116,39 @@ public final class SqlObjectStore implem
                 final DatabaseConnector connection = ((SqlExecutionContext) context).getConnection();
                 LOG.debug("  save object " + object);
                 if (object.getSpecification().isCollectionOrIsAggregated()) {
-                    /*
-                     * ObjectAdapter parent = object.getSpecification().getAggregate(object);
LOG.debug(
-                     * "change to internal collection being persisted through parent" );
-                     * 
-                     * // TODO a better plan would be ask the mapper to save the collection
// - saveCollection(parent,
-                     * collection) mapperLookup.getMapper(connection, parent).save(connection,
parent);
-                     * connectionPool.release(connection);
-                     */
-                    throw new NotYetImplementedException(object.toString());
+
+                    ObjectAdapter parent = object.getAggregateRoot();
+                    LOG.debug("change to internal collection being persisted through parent");
+
+                    Oid oid = object.getOid();
+                    if (oid instanceof AggregatedOid) {
+                        AggregatedOid aoid = (AggregatedOid) oid;
+                        final ObjectMapping mapping2 = objectMappingLookup.getMapping(parent,
connection);
+
+                        if (mapping2.saveCollection(connection, parent, aoid.getId()) ==
false) {
+                            final ObjectMapping mapping = objectMappingLookup.getMapping(parent,
connection);
+                            mapping.save(connection, object);
+                        }
+                        connectionPool.release(connection);
+                    } else {
+                        throw new NotYetImplementedException(object.toString());
+                    }
+                    // / ObjectAssociation assoc = parent.getSpecification().getAssociation(aoid.getId());
+
+                    // / ObjectAdapter realObject = assoc.get(parent);
+
+                    // for (final CollectionMapper collectionMapper : collectionMappers)
{
+                    // collectionMapper.saveInternalCollection(connector, object);
+                    // }
+                    // /}
+
+                    // TODO a better plan would be ask the mapper to save the collection
+                    // -saveCollection(parent,collection)
+
+                    // mapperLookup.getMapper(connection, parent).save(connection, parent);
+                    // connectionPool.release(connection);
+
+                    // throw new NotYetImplementedException(object.toString());
                 } else {
                     final ObjectMapping mapping = objectMappingLookup.getMapping(object,
connection);
                     mapping.save(connection, object);

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java?rev=1167584&r1=1167583&r2=1167584&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java
Sat Sep 10 19:51:40 2011
@@ -71,6 +71,7 @@ public abstract class AbstractAutoMapper
     }
 
     protected CollectionMapper collectionMappers[];
+    protected String collectionMapperFields[];
     protected boolean dbCreatesId;
 
     protected ObjectSpecification specification;
@@ -149,6 +150,7 @@ public abstract class AbstractAutoMapper
         final ObjectAssociation[] oneToOneProperties = new ObjectAssociation[simpleFieldCount];
         final ObjectAssociation[] oneToManyProperties = new ObjectAssociation[collectionFieldCount];
         collectionMappers = new CollectionMapper[collectionFieldCount];
+        collectionMapperFields = new String[collectionFieldCount];
         // Properties collectionMappings = configParameters.getPropertiesStrippingPrefix(parameterBase
+
         // "collection");
         final IsisConfiguration subset = IsisContext.getConfiguration().createSubset(parameterBase
+ ".mapper.");
@@ -190,6 +192,7 @@ public abstract class AbstractAutoMapper
                     }
 
                     collectionMappers[collectionFieldNo] = collectionMapper;
+                    collectionMapperFields[collectionFieldNo] = field.getId();
 
                 } else if (type.equals("fk-table")) {
                     final String property = parameterBase + field.getId() + ".element-type";

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java?rev=1167584&r1=1167583&r2=1167584&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AutoMapper.java
Sat Sep 10 19:51:40 2011
@@ -170,13 +170,12 @@ public class AutoMapper extends Abstract
         final ObjectSpecification patternSpec = pattern.getSpecification();
         final List<ObjectAssociation> patternAssociations = patternSpec.getAssociations();
         for (ObjectAssociation patternAssoc : patternAssociations) {
-            // LOG.debug(assoc.getName());
             final Method method;
-            try {
-                final Identifier identifier = patternAssoc.getIdentifier();
-                final String memberName = identifier.getMemberName();
-                final String methodName = memberName.substring(0, 1).toUpperCase() + memberName.substring(1);
+            final Identifier identifier = patternAssoc.getIdentifier();
+            final String memberName = identifier.getMemberName();
+            final String methodName = memberName.substring(0, 1).toUpperCase() + memberName.substring(1);
 
+            try {
                 method = o.getClass().getMethod("get" + methodName, (Class<?>[]) null);
                 final Object res = InvokeUtils.invoke(method, o);
                 if (res != null) {
@@ -188,15 +187,12 @@ public class AutoMapper extends Abstract
                     final ObjectSpecification specification = patternAssoc.getSpecification();
                     if (specification.isValue()) {
                         // If the property (memberName) is a value type, use the value.
-                        LOG.debug("Pattern Assoc Is Value");
                         final String fieldName = Sql.sqlFieldName(identifier.getMemberName());
                         sql.append(fieldName + "=?");
                         connector.addToQueryValues(res);
                         foundFields++;
                     } else {
                         // If the property (memberName) is an entity, use the ID.
-                        LOG.debug("Pattern Assoc Is Entity");
-
                         FieldMapping fieldMapping = fieldMappingLookup.get(patternAssoc);
 
                         fieldMapping.appendColumnNames(sql);
@@ -214,6 +210,7 @@ public class AutoMapper extends Abstract
             } catch (SecurityException e) {
                 LOG.debug(e.getMessage());
             } catch (NoSuchMethodException e) {
+                LOG.info("Unable to invode method: get" + methodName + " in getInstances");
                 LOG.debug(e.getMessage());
             }
         }
@@ -412,6 +409,20 @@ public class AutoMapper extends Abstract
     }
 
     @Override
+    public boolean saveCollection(DatabaseConnector connection, ObjectAdapter parent, String
fieldName) {
+        int i = 0;
+        for (String collectionFieldName : collectionMapperFields) {
+            if (collectionFieldName.equals(fieldName)) {
+                CollectionMapper fieldMapper = collectionMappers[i];
+                fieldMapper.saveInternalCollection(connection, parent);
+                return true;
+            }
+            i++;
+        }
+        return false;
+    }
+
+    @Override
     public String toString() {
         return "AutoMapper [table=" + table + ",id=" + idMapping + ",noColumns=" + fieldMappings.size()
             + ",specification=" + specification.getFullIdentifier() + "]";

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/CombinedCollectionMapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/CombinedCollectionMapper.java?rev=1167584&r1=1167583&r2=1167584&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/CombinedCollectionMapper.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/CombinedCollectionMapper.java
Sat Sep 10 19:51:40 2011
@@ -29,6 +29,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.adapter.ResolveState;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.runtimes.dflt.objectstores.sql.CollectionMapper;
 import org.apache.isis.runtimes.dflt.objectstores.sql.DatabaseConnector;
@@ -187,7 +188,18 @@ public class CombinedCollectionMapper ex
         final ObjectAdapter collection = field.get(parent);
         LOG.debug("Saving internal collection " + collection);
 
-        StringBuffer sql = new StringBuffer();
+        final CollectionFacet collectionFacet = collection.getSpecification().getFacet(CollectionFacet.class);
+        final Iterable<ObjectAdapter> elements = collectionFacet.iterable(collection);
+
+        // TODO What is needed to allow a collection update (add/remove) to mark the collection
as dirty?
+        // checkIfDirty(collection);
+
+        if (elements.iterator().hasNext() == false) {
+            return;
+        }
+
+        // Delete collection parent
+        final StringBuffer sql = new StringBuffer();
         sql.append("update ");
         sql.append(table);
         sql.append(" set ");
@@ -196,21 +208,53 @@ public class CombinedCollectionMapper ex
         foreignKeyMapping.appendUpdateValues(connector, sql, parent);
         connector.update(sql.toString());
 
-        sql = new StringBuffer();
-        sql.append("update ");
-        sql.append(table);
-        sql.append(" set ");
+        // Reinstall collection parent
+        // sql = new StringBuffer();
 
-        final CollectionFacet collectionFacet = collection.getSpecification().getFacet(CollectionFacet.class);
-        for (final ObjectAdapter element : collectionFacet.iterable(collection)) {
-            final StringBuffer update = new StringBuffer(sql);
-            foreignKeyMapping.appendUpdateValues(connector, update, parent);
-            update.append(" where ");
-            idMapping.appendWhereClause(connector, update, element.getOid());
+        final StringBuffer update = new StringBuffer();
+        update.append("update ");
+        update.append(table);
+        update.append(" set ");
+
+        foreignKeyMapping.appendUpdateValues(connector, update, parent);
+        update.append(" where ");
+
+        idMapping.appendColumnNames(update);
+
+        update.append(" IN (");
+
+        int count = 0;
+        for (final ObjectAdapter element : elements) {
+            if (count++ > 0) {
+                update.append(",");
+            }
+            idMapping.appendObjectId(connector, update, element.getOid());
+        }
+        update.append(")");
+        if (count > 0) {
             connector.insert(update.toString());
         }
     }
 
+    protected void checkIfDirty(final ObjectAdapter collection) {
+        // Test: is dirty?
+        ObjectSpecification collectionSpecification = collection.getSpecification();
+        if (collectionSpecification.isDirty(collection)) {
+            LOG.debug(collection.getOid() + " is dirty");
+        } else {
+            LOG.debug(collection.getOid() + " is clean");
+        }
+
+        final CollectionFacet collectionFacetD = collection.getSpecification().getFacet(CollectionFacet.class);
+        for (final ObjectAdapter element : collectionFacetD.iterable(collection)) {
+            if (collectionSpecification.isDirty(element)) {
+                LOG.debug(element.getOid() + " is dirty");
+            } else {
+                LOG.debug(element.getOid() + " is clean");
+            }
+        }
+    }
+
     @Override
     public void debugData(final DebugBuilder debug) {
         debug.appendln(field.getName(), "collection");

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/AbstractJdbcMultiFieldMapping.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/AbstractJdbcMultiFieldMapping.java?rev=1167584&r1=1167583&r2=1167584&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/AbstractJdbcMultiFieldMapping.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/jdbc/AbstractJdbcMultiFieldMapping.java
Sat Sep 10 19:51:40 2011
@@ -99,32 +99,33 @@ public abstract class AbstractJdbcMultiF
 
     @Override
     public void appendUpdateValues(final DatabaseConnector connector, final StringBuffer
sql, final ObjectAdapter object) {
+        final ObjectAdapter fieldValue = field.get(object);
+        final Object o = (fieldValue == null) ? null : fieldValue.getObject();
         for (int i = 0; i < columnCount; i++) {
-            appendEqualsClause(connector, i, sql, object, "=");
+            appendEqualsClause(connector, i, sql, o, "=");
         }
     }
 
     @Override
     public void appendWhereClause(final DatabaseConnector connector, final StringBuffer sql,
final ObjectAdapter object) {
+        final ObjectAdapter fieldValue = field.get(object);
+        final Object o = (fieldValue == null) ? null : fieldValue.getObject();
         for (int i = 0; i < columnCount; i++) {
-            appendEqualsClause(connector, i, sql, object, "=");
+            appendEqualsClause(connector, i, sql, o, "=");
         }
     }
 
-    protected void appendEqualsClause(final DatabaseConnector connector, final int index,
final StringBuffer sql,
-        final ObjectAdapter object, final String condition) {
+    private void appendEqualsClause(final DatabaseConnector connector, final int index, final
StringBuffer sql,
+        final Object object, final String condition) {
 
-        final ObjectAdapter fieldValue = field.get(object);
-        final Object o = (fieldValue == null) ? null : fieldValue.getObject();
-
-        for (int i = 0; i < columnCount; i++) {
-            sql.append(columnName(i) + condition + "?");
-            if (i < columnCount - 1) {
-                sql.append(", ");
-            }
+        final Object oPart = preparedStatementObject(index, object);
 
-            connector.addToQueryValues(o);
+        sql.append(columnName(index) + condition + "?");
+        if (index < columnCount - 1) {
+            sql.append(", ");
         }
+
+        connector.addToQueryValues(oPart);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java?rev=1167584&r1=1167583&r2=1167584&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommon.java
Sat Sep 10 19:51:40 2011
@@ -591,9 +591,28 @@ public abstract class SqlIntegrationTest
         getSingletonInstance().setState(1);
     }
 
+    public void testUpdateCollectionIsDirty() {
+        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
+
+        final List<SqlDataClass> sqlDataClasses = factory.allDataClasses();
+        SqlDataClass sqlDataClass = sqlDataClasses.get(0);
+
+        final List<SimpleClass> collection = sqlDataClass.getSimpleClasses1();
+        SimpleClass simpleClass1 = collection.get(0);
+        // simpleClass1.setString(stringList1.get(3));
+
+        collection.remove(simpleClass1);
+        // XML objectstore doesn't support this.
+        if (getProperties().getProperty("isis.persistor") != "xml") {
+            factory.update(collection);
+        }
+
+        factory.update(sqlDataClass);
+    }
+
     public void testFindByMatchString() {
         final SimpleClass simpleClassMatch = new SimpleClass();
-        simpleClassMatch.setString(stringList1.get(0));
+        simpleClassMatch.setString(stringList1.get(1));
 
         final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
         final List<SimpleClass> classes = factory.allSimpleClassesThatMatch(simpleClassMatch);
@@ -612,6 +631,8 @@ public abstract class SqlIntegrationTest
         // TODO: Why is this hack required?
         if (getProperties().getProperty("isis.persistor") != "in-memory") {
             assertEquals(stringList1.size(), classes.size());
+        } else {
+            assertEquals(stringList1.size() + 2, classes.size());
         }
 
     }



Mime
View raw message