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

Type: BugVersion: 2.2.7Priority: NormalStatus: FixedReplies: 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
com.objectdb.o.InternalException: java.lang.NullPointerException: null
at com.objectdb.o.RFV.U(
at com.objectdb.o.RFV.E(
at com.objectdb.o.TYW.writeElement(
at com.objectdb.o.QRR.l(
at com.objectdb.o.QRR.g(
at com.objectdb.o.QRR.b(
at com.objectdb.jpa.JpaQuery.getResultList(

Source available at


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 =
        EntityManager em = emf.createEntityManager();

        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();


    public static final class MyEntity {
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login