490 words

Issue #159 - JPA Composite Key make Object Db throws "Unexpected exception (Error 990)"

BugVersion: 2.4.0Priority: NormalStatus: FixedReplies: 3
#1
2012-07-12 08:08

Hello Object Db community :)

I am using this wonderful library and I caught a strange exception while testing the "composite key" feature in JPA.

Let's see what I am doing :

@Entity
public class Book {
    @EmbeddedId BookId id;
}
 
@Embeddable
Class BookId {
    Integer bookIdCountry;
    ECountry country;
}

My BookId contains 2 attributes:
One Integer and one enum.

These attributes are compliant with the object Db Documentation:
http://www.objectdb.com/java/jpa/entity/id

Unfortunately, while merging the entity, object db is throwing the following Exception :

[ObjectDB 2.4.0] Unexpected exception (Error 990)

My bookId and its attributes are NEVER null.

Have you any idea about this problem?

#####

Additionals infos, here is the stack trace :

[ObjectDB 2.4.0] Unexpected exception (Error 990)
     Generated by OpenJDK 64-Bit Server VM 1.6.0_18 (on Linux 2.6.32).
    Please report this error on http://www.objectdb.com/database/issue/new
    com.objectdb.o.InternalException: null
    com.objectdb.o.InternalException
     at com.objectdb.o.VUT.e(VUT.java:221)
     at com.objectdb.o.VUT.e(VUT.java:148)
     at com.objectdb.o.UMR.s(UMR.java:426)
     at com.objectdb.o.UMR.q(UMR.java:382)
     at com.objectdb.o.UML.s(UML.java:484)
     at com.objectdb.o.MMM.X(MMM.java:794)
     at com.objectdb.o.EMR.h(EMR.java:140)
     at com.objectdb.o.TVS.g(TVS.java:104)
     at com.objectdb.o.TVS.g(TVS.java:93)
     at com.objectdb.o.EMR.q(EMR.java:75)

The problem occurs on the VUT class on the call "e" method. A look at the bytecode show :

L219 to 221 : checkcast BigInteger

I don't know why this cast is made ... i haven't any BigInteger in my app.

Well, debugging obfuscated code is not easy for me.

Any help would be appreciated :)

xirt
xirt's picture
Joined on 2012-07-12
User Post #1
#2
2012-07-12 23:13

Can you please attach a small test that demonstrates the exception?

If you can use the format in the posting instructions it may be very helpful.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,155
#3
2012-07-13 12:09

Well i have tested a small case test with minimal code, so i have pointed out the problem.  It's comes from the "enum" type which is not correctly taken into account by Object Db. When I replace EEnum type by an Integer, all is fine !

May the problem be reproduced with a simple ( not embedded Id ) key with an enum type.

Here is the code :

package test;
 
import java.util.*;
import javax.persistence.*;
 
public final class MyTestCase {
 
    @Entity
    public static class MyEntity {
        @EmbeddedId public MyEntityId id;
    }
 
    @Embeddable
    public static class MyEntityId {
        public EEnum enumeration;
    }
 
    public enum EEnum {
        FIRST,
        SECOND;
    }
 
    public static void main(String[] args)  {
 
        EntityManagerFactory emf =
            Persistence.createEntityManagerFactory(
                "objectdb:$objectdb/db/test.tmp;drop");
 
        EntityManager em = emf.createEntityManager();
 
        em.getTransaction().begin();
        MyEntity entity = new MyEntity();
        MyEntityId entityId = new MyEntityId();
 
        entityId.enumeration = EEnum.FIRST;
        entity.id = entityId;
 
        em.persist(entity);
        em.getTransaction().commit();
 
        Query query = em.createQuery("SELECT e FROM MyEntity e");
        List resultList = query.getResultList();
        System.out.println(resultList);
 
        em.close();
        emf.close();
    }
}

The stack trace follows :

Exception in thread "main" [ObjectDB 2.4.0] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) Client VM 1.6.0_32 (on Windows XP 5.1).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: null
com.objectdb.o.InternalException
at com.objectdb.o.VUT.e(VUT.java:221)
at com.objectdb.o.VUT.e(VUT.java:148)
at com.objectdb.o.UMR.s(UMR.java:426)
at com.objectdb.o.UMR.q(UMR.java:382)
at com.objectdb.o.UML.s(UML.java:478)
at com.objectdb.o.MMM.X(MMM.java:794)
at com.objectdb.o.OBM.bx(OBM.java:387)
at com.objectdb.o.OBM.bx(OBM.java:252)
at com.objectdb.jpa.EMImpl.persist(EMImpl.java:375)
xirt
xirt's picture
Joined on 2012-07-12
User Post #2
#4
2012-07-16 01:09

Thank you for this report.

Please try build 2.4.1_06 that should fix this exception.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #1,161

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