Upgrade problem

From: Todd O'Bryan (toddobrya..ac.com)
Date: Wed Apr 07 2004 - 04:59:40 EDT

  • Next message: Michele Cuozzo: "it works!!"

    I upgraded to 1.1M4 from 1.0 and now I get this Exception

    Exception in thread "main" java.lang.NoSuchMethodError:
    org.apache.commons.collections.IteratorUtils.singletonIterator(Ljava/
    lang/Object;)Lorg/apache/commons/collections/ResettableIterator;
            at
    org.objectstyle.cayenne.map.ObjAttribute.getDbPathIterator(ObjAttribute.
    java:140)
            at
    org.objectstyle.cayenne.map.ObjAttribute.getDbAttribute(ObjAttribute.jav
    a:111)
            at
    org.objectstyle.cayenne.CayenneDataObject.validateForSave(CayenneDataObj
    ect.java:585)
            at
    org.objectstyle.cayenne.CayenneDataObject.validateForInsert(CayenneDataO
    bject.java:625)
            at
    org.objectstyle.cayenne.access.ObjectStore.validateUncommittedObjects(Ob
    jectStore.java:830)
            at
    org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.jav
    a:1169)
            at
    org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.jav
    a:1145)
            at org.dupontmanual.cayenne.Role.main(Role.java:20)

    when I try to run this code to populate a table that's being used as an
    enum type

    package org.dupontmanual.cayenne;

    import org.objectstyle.cayenne.access.DataContext;
    import org.objectstyle.cayenne.exp.ExpressionFactory;
    import org.objectstyle.cayenne.query.SelectQuery;

    public class Role extends org.dupontmanual.cayenne.auto._Role {
            public static String[] values = { "student", "teacher", "admin" };
            
            public static Role getRole(DataContext dc, String value) {
                    SelectQuery q = new SelectQuery(Role.class,
    ExpressionFactory.matchExp("value", value));
                    return (Role) dc.performQuery(q).get(0);
            }
            
            public static void main(String[] args) {
                    DataContext dc = DataContext.createDataContext();
                    for (int i=0; i<values.length; i++) {
                            Role role = (Role) dc.createAndRegisterNewObject("Role");
                            role.setValue(values[i]);
                            dc.commitChanges();
                    }
            }
    }

    I've checked, and singletonIterator() really does exist where it should.

    Any idea what's up?

    I'm using Eclipse and writing a Tapestry application, so I'm copying
    cayenne.jar plus all the tapestry jars into my WEB-INF/lib folder.

    Thanks,
    Todd

    P.S. Is there some semi-standard way to handle enum tables? I've
    decided I could create a superclass that has a populate() method and
    call that when I rebuild tables and such during development. Better
    ideas?



    This archive was generated by hypermail 2.0.0 : Wed Apr 07 2004 - 04:59:45 EDT