users@glassfish.java.net

persist/merge problem

From: <glassfish_at_javadesktop.org>
Date: Wed, 01 Apr 2009 14:45:55 PDT

I'm having difficulty debugging internals of glassfish.

Here's when I want to persist the object of type Queue:

                                Queue queue = (Queue)session.getAttribute("cart");
                                EntityManager em = WebAppManager.getInstance().getEntityManagerFactory().createEntityManager();
                                em.getTransaction().begin();
                                //account = em.merge(account);
                                queue.setAccount(account);
                                
                                
                                
                                em.persist(queue);
                                em.getTransaction().commit();
                                em.close();

I get an exception from (signin.jsp):

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
        at oracle.toplink.essentials.internal.helper.NonSynchronizedVector.get(NonSynchronizedVector.java:287)
        at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.getPrimaryKeyClassifications(ObjectBuilder.java:1817)
        at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.extractPrimaryKeyFromObject(ObjectBuilder.java:1532)
        at oracle.toplink.essentials.queryframework.DoesExistQuery.checkEarlyReturn(DoesExistQuery.java:166)
        at oracle.toplink.essentials.queryframework.DoesExistQuery.checkEarlyReturn(DoesExistQuery.java:245)
        at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:575)
        at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:555)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2248)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952)
        at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:3256)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:432)
        at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3226)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:221)
        at org.apache.jsp.pages.signin_jsp._jspService(signin_jsp.java from :98)
etc...

I tried many things, I just don't have an idea, which array is empty...
or if I am going in wrong direction... any help would be welcome.
[Message sent by forum member 'snovak7' (snovak7)]

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