172 words

Issue #51 - NPE on em.createQuery(query).getResultList()

BugVersion: 2.2.7Priority: NormalStatus: FixedReplies: 1
#1
2011-07-02 04:21

(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

kaosko
kaosko's picture
Joined on 2011-01-17
User Post #1
#2
2011-07-02 19:38

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 I51 {
 
    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)
support
support's picture
Joined on 2010-05-03
User Post #401

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel