Re: Entity Modeler SQL generation trouble

From: Chuck Hill (chil..lobal-village.net)
Date: Tue Nov 13 2007 - 12:51:56 EST

  • Next message: Mike Schrag: "Re: Ramblings on Build System"

    On Nov 13, 2007, at 8:39 AM, Zak Burke wrote:

    > I cannot generate SQL for an EO Model in a framework project. It
    > seems like the problem may be (?) that the EO's .java file is being
    > parsed/loaded before the EO model file. The full stacktrace is
    > below, but the root of the problem is the initialization of the
    > following static variable on the EO SourceDnd:
    >
    > public static final SourceDnd DARTMOUTH_DND =
    > SourceDnd.sourceDndById(Integer.valueOf(1));
    >
    > The method SourceDnd.sourceDndById is nothing fancy; it does a
    > simple fetch via EOUtilities:
    >
    > return (SourceDnd) EOUtilities.objectMatchingKeyAndValue(ec,
    > SourceDnd.ENTITY_NAME, SourceDnd.ID_KEY, id);

    Never mind the SQL generation. That seems like a breathtakingly
    dangerous thing to do with EOF.

    Chuck

    > java.lang.ExceptionInInitializerError
    > at java.lang.Class.forName0(Native Method)
    > at java.lang.Class.forName(Class.java:164)
    > at com.webobjects.foundation._NSUtilities._classWithPartialName
    > (_NSUtilities.java:307)
    > at com.webobjects.foundation._NSUtilities.classWithName
    > (_NSUtilities.java:291)
    > at com.webobjects.eoaccess.EOModel._setEntityForEntityNameClassName
    > (EOModel.java:1242)
    > at com.webobjects.eoaccess.EOModel._addFakeEntityWithPropertyList
    > (EOModel.java:1280)
    > at
    > com.webobjects.eoaccess.EOModel._initWithTableOfContentsPropertyListPa
    > thURL(EOModel.java:1092)
    > at com.webobjects.eoaccess.EOModel.<init>(EOModel.java:802)
    > at com.webobjects.eoaccess.EOModelGroup.addModelWithPathURL
    > (EOModelGroup.java:498)
    > at org.objectstyle.wolips.eomodeler.core.sql.EOFSQLGenerator.<init>
    > (EOFSQLGenerator.java:120)
    > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
    > Method)
    > at sun.reflect.NativeConstructorAccessorImpl.newInstance
    > (NativeConstructorAccessorImpl.java:39)
    > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
    > (DelegatingConstructorAccessorImpl.java:27)
    > at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    > at
    > org.objectstyle.wolips.eomodeler.core.sql.EOFSQLGeneratorFactory.sqlGe
    > nerator(EOFSQLGeneratorFactory.java:33)
    > at
    > org.objectstyle.wolips.eomodeler.actions.GenerateSQLDialog.generateSql
    > (Unknown Source)
    > at org.objectstyle.wolips.eomodeler.actions.GenerateSQLDialog$1.run
    > (Unknown Source)
    > at java.lang.Thread.run(Thread.java:613)
    > Caused by: java.lang.IllegalArgumentException: An object store for
    > the entity "SourceDnd" could not be found. Verify that the entity
    > is defined in an EOModel, and that the model is installed properly.
    > To see what models are loaded, you can try printing the return
    > value of EOModelGroup.defaultGroup() in your application.
    > at
    > com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpec
    > ification(EOObjectStoreCoordinator.java:536)
    > at
    > com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecificatio
    > n(EOEditingContext.java:4114)
    > at
    > com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecificatio
    > n(EOEditingContext.java:4500)
    > at com.webobjects.eoaccess.EOUtilities.objectsMatchingValues
    > (EOUtilities.java:193)
    > at com.webobjects.eoaccess.EOUtilities.objectsMatchingKeyAndValue
    > (EOUtilities.java:168)
    > at com.webobjects.eoaccess.EOUtilities.objectMatchingKeyAndValue
    > (EOUtilities.java:290)
    > at edu.dartmouth.dltg.pns.eos.SourceDnd.sourceDndById
    > (SourceDnd.java:45)
    > at edu.dartmouth.dltg.pns.eos.SourceDnd.<clinit>(SourceDnd.java:20)
    > ... 18 more
    >
    >

    -- 
    

    Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects



    This archive was generated by hypermail 2.0.0 : Tue Nov 13 2007 - 12:53:38 EST