users@glassfish.java.net

JPA Error: java.lang.NullPointerException

From: <glassfish_at_javadesktop.org>
Date: Mon, 06 Aug 2007 06:17:22 PDT

Hi,

I am getting a NullPointerException and don't know why!

The data is a DATA object with a list of properties (PROPERTY) (@OneToMany)!
First persisting the DATA --> works fine
I detach the DATA Element and set a new PROPERTY object
merging the DATA of the data --> works fine
I do the same again detaching the object and set a new PROPERTY object
merging the DATA --> NullPointerException?!

Why, what is different, why doesn't it work the second time?

I am happy for any hint...

If you need further information I am happy to provide them...

Thanks

Marcel
 
If I have a look in code of the "CollectionContainerPolicy.iteratorFor" the method tries to return an iterator and apparently the object has a null value, but why?

Here is the stack trace...

Merge Data
[TopLink Finer]: 2007.08.06 02:40:08.421--ServerSession(6597453)--Thread(Thread[AWT-EventQueue-0,6,main])--client acquired
[TopLink Finest]: 2007.08.06 02:40:08.421--UnitOfWork(20238918)--Thread(Thread[AWT-EventQueue-0,6,main])--Merge clone with references Data
Caught Exception: null
java.lang.NullPointerException
        at oracle.toplink.essentials.internal.queryframework.CollectionContainerPolicy.iteratorFor(CollectionContainerPolicy.java:172)
        at oracle.toplink.essentials.internal.helper.WriteLockManager.traverseRelatedLocks(WriteLockManager.java:171)
        at oracle.toplink.essentials.internal.helper.WriteLockManager.acquireLockAndRelatedLocks(WriteLockManager.java:149)
        at oracle.toplink.essentials.internal.helper.WriteLockManager.checkAndLockObject(WriteLockManager.java:378)
        at oracle.toplink.essentials.internal.helper.WriteLockManager.traverseRelatedLocks(WriteLockManager.java:186)
        at oracle.toplink.essentials.internal.helper.WriteLockManager.acquireLockAndRelatedLocks(WriteLockManager.java:149)
        at oracle.toplink.essentials.internal.helper.WriteLockManager.acquireLocksForClone(WriteLockManager.java:89)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(UnitOfWorkImpl.java:669)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkIdentityMapAccessor.getAndCloneCacheKeyFromParent(UnitOfWorkIdentityMapAccessor.java:167)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkIdentityMapAccessor.getFromIdentityMap(UnitOfWorkIdentityMapAccessor.java:105)
        at oracle.toplink.essentials.internal.sessions.IdentityMapAccessor.getFromIdentityMap(IdentityMapAccessor.java:310)
        at oracle.toplink.essentials.internal.sessions.MergeManager.registerObjectForMergeCloneIntoWorkingCopy(MergeManager.java:674)
        at oracle.toplink.essentials.internal.sessions.MergeManager.mergeChangesOfCloneIntoWorkingCopy(MergeManager.java:411)
        at oracle.toplink.essentials.internal.sessions.MergeManager.mergeChanges(MergeManager.java:264)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.mergeCloneWithReferences(UnitOfWorkImpl.java:2723)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.mergeCloneWithReferences(RepeatableWriteUnitOfWork.java:219)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.mergeInternal(EntityManagerImpl.java:235)
        at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.merge(EntityManagerImpl.java:128)
        at MainProgramManagement.ProgramMain.mergeData(ProgramMain.java:846)
        at MainProgramManagement.PersistenceDBManager.saveDataToDB(PersistenceDBManager.java:552)
        at
[Message sent by forum member 'javari' (javari)]

http://forums.java.net/jive/thread.jspa?messageID=229597