ObjectDB ObjectDB

Issue #365: NPE on em.createQuery(query).getResultList()

Type: Bug ReoprtVersion: 2.2.7Priority: NormalStatus: FixedReplies: 1
#1

(JPA2 support getting better but still not quite there, excellent progress regardless). Difficult to see what's going on because of obfuscation, but it didn't look like this exact issue was reported yet (seemed to differ from the other reported and fixed NPEs):

[ObjectDB 2.2.7_09] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) 64-Bit Server VM 1.6.0_25 (on Windows 7 6.1).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: java.lang.NullPointerException: null
java.lang.NullPointerException
at com.objectdb.o.RFV.U(RFV.java:228)
at com.objectdb.o.RFV.E(RFV.java:216)
at com.objectdb.o.TYW.writeElement(TYW.java:207)
at com.objectdb.o.QRR.l(QRR.java:401)
at com.objectdb.o.QRR.g(QRR.java:223)
at com.objectdb.o.QRR.b(QRR.java:144)
at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:627)
at org.tynamo.seedentity.jpa.services.SeedEntityImpl.<init>(SeedEntityImpl.java:56)
at org.tynamo.seedentity.jpa.services.SeedEntityImplTest.seedEntities(SeedEntityImplTest.java:65)

Source available at http://svn.codehaus.org/tynamo/trunk/tapestry-jpa-seedentity

edit
delete
#2

Thank you for your report.

I could reproduce the exception by sending a new entity object with no allocated ID (before commit) as a query parameter.

Please try build 2.2.8 that should fix this bug.

import javax.persistence.*;

public class T365 {
   
    public static void main(String[] args) {

        EntityManagerFactory emf =
            Persistence.createEntityManagerFactory("$objectdb/db/test.odb");
        EntityManager em = emf.createEntityManager();

        em.getTransaction().begin();      
        MyEntity e = new MyEntity();
        em.persist(e); // entity with no ID as a parameter
        Query query = em.createQuery(
            "SELECT e FROM MyEntity e WHERE e = :p");
        query.setParameter("p", e).getResultList();
        em.getTransaction().commit();

        em.close();
        emf.close();
    }

    @Entity
    public static final class MyEntity {
    }
}
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
edit
delete

Reply

To post on this website please sign in.