Re: NullPointerException when I commit

From: Joshua Pyle (joshua.t.pyl..mail.com)
Date: Fri Jan 14 2005 - 13:46:42 EST

  • Next message: Andrus Adamchik: "Re: ResultSet with ORACLE Stored Procedure OUT Parameter"

    Sorry for the post I can not recreate the error now. I was running
    this bit of code in Tomcat locally and I think something got outa
    whack. I have just done a restart of Tomcat and the issue does not
    come up any more.

    -- 
    Joshua T. Pyle
    Go has always existed.
    

    On Fri, 14 Jan 2005 13:39:24 -0500, Mike Kienenberger <mkienen..laska.net> wrote: > What version of Cayenne are you using? > > Are you doing anything else in this context besides deleting objects? > (inserting/modifying) > If not, what is the output of "toDelete Before" for each object? > > It's unclear to me how you could end up with a DataObject in a context > without a valid ObjectID. > > ObjectId id = object.getObjectId(); > > if (id.getReplacementId() != null) { > > > -Mike > > > Joshua Pyle <joshua.t.pyl..mail.com> wrote: > > This NullPointer Exception is happening consitently Here is the code > > segment causing this.... > > > > //Delete all of the permissions > > int size = currentPermissions.size(); > > for (int i = 0; i < size; i++) { > > DataObject toDelete = (DataObject) currentPermissions.get(i); > > System.out.println( "toDelete Before - " + toDelete ); > > dbContext.deleteObject(toDelete); > > System.out.println( "toDelete After - " + toDelete ); > > } > > > > try{ > > dbContext.commitChanges(); > > }catch( Exception e ){ > > dbContext.rollbackChanges(); > > e.printStackTrace( System.out ); > > } > > > > This is the exception line... > > > > at > org.objectstyle.cayenne.access.ObjectStore.objectsCommitted(ObjectStore.java:478) > > at > org.objectstyle.cayenne.access.ContextCommit.commit(ContextCommit.java:215) > > at > org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1266) > > at > org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1236) > > at > com.ray.rms.it.esolutions.mla.view.Admin.User.ProcEditUser.buildPermissionsFromPrograms(ProcEditUser.java:266) > > > > I'm assuming either that I'm doing this wrong or there is a bug at > > ObjectStore.java:478 > > > > * if (id.getReplacementId() != null) { > > if (modifiedIds == null) { > > modifiedIds = new ArrayList(); > > } > > > > modifiedIds.add(id); > > > > // postpone processing of objects that require an id > change > > continue; > > } > >



    This archive was generated by hypermail 2.0.0 : Fri Jan 14 2005 - 13:46:44 EST