RE: Cayenne newbe question

From: JR Ruggentaler (JR.Ruggentale..pv.com)
Date: Fri Jan 14 2005 - 12:36:11 EST

  • Next message: Joshua Pyle: "NullPointerException when I commit"

    Thanks for the prompt response! I was missing the DataNode. I reread the first page or two of the modeler documentation and was able to correct my mistake.

    Thanks again!
    J.R.

    -----Original Message-----
    From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Sent: Friday, January 14, 2005 8:28 AM
    To: cayenne-use..bjectstyle.org
    Subject: Re: Cayenne newbe question

    Here is the source code of CayenneDataObject:

    Line 574: ObjEntity objEntity =
    getDataContext().getEntityResolver().lookupObjEntity(this);

    Line 575: ExtendedTypeMap types = getDataContext()
                    .lookupDataNode(objEntity.getDataMap())
                    .getAdapter()
                    .getExtendedTypes();

    So DataContext is not null. You need to figure what else can be null. It
    is either DataNode or ObjEntity. Do you have a DataNode created in the
    Modeler?

    Andrus

    > I created a Model and generated source and schema using CayenneModeler
    > without any problem. Next a wrote a simple test using eclipse 3.x and
    > when I message dContext.commitChanges(org.apache.log4j.Level.ALL); I get
    > the following exception.
    >
    > java.lang.NullPointerException
    > at
    > org.objectstyle.cayenne.CayenneDataObject.validateForSave(CayenneDataObject.java:575)
    > at
    > org.objectstyle.cayenne.CayenneDataObject.validateForInsert(CayenneDataObject.java:700)
    > at
    > org.objectstyle.cayenne.access.ObjectStore.validateUncommittedObjects(ObjectStore.java:937)
    > at
    > org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1260)
    >
    > Is this a model issue or a configuration issue? My classpath looks like
    > C:\eclipse3\workspace\MyProject\build;C:\eclipse3\workspace\MyProject\libs\cayenne.jar.
    > I copied cayenne.xml and my map into ...\MyProject\build.
    >
    > J.R.



    This archive was generated by hypermail 2.0.0 : Fri Jan 14 2005 - 12:36:14 EST