370 words

Issue #71 - query.getResultList() throws ClassCastException

BugVersion: 2.3.0Priority: NormalStatus: FixedReplies: 3
#1
2011-09-30 20:50

I modified the example code to include an index on the Point class like so:

    @Index(members={"x","y"})

Then when I run the following query:

    TypedQuery<Point> query = em.createQuery("SELECT p FROM Point p where p.x <= :x and p.y >= :y",
        Point.class);

I get the exception at the end.  I do not get an exception if I:

  • Use no index
  • Index only on "x"
  • Use an OR in the query instead of AND
[ObjectDB 2.3.0_04] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) 64-Bit Server VM 1.6.0_22 (on Windows 7 6.1).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: java.lang.ClassCastException: com.objectdb.o.NLV cannot be cast to com.objectdb.o.CMV
java.lang.ClassCastException: com.objectdb.o.NLV cannot be cast to com.objectdb.o.CMV
at com.objectdb.o.VOB.l(VOB.java:218)
at com.objectdb.o.NFL.Uu(NFL.java:89)
at com.objectdb.o.SBI.u(SBI.java:109)
at com.objectdb.o.OBI.w(OBI.java:466)
at com.objectdb.o.OBI.<init>(OBI.java:188)
at com.objectdb.o.SBI.<init>(SBI.java:50)
at com.objectdb.o.MST.aU(MST.java:737)
at com.objectdb.o.BQI.Ut(BQI.java:123)
at com.objectdb.o.FQI.Ut(FQI.java:68)
at com.objectdb.o.PRG.ab(PRG.java:603)
at com.objectdb.o.QRM.US(QRM.java:259)
at com.objectdb.o.MST.US(MST.java:892)
at com.objectdb.o.WRA.US(WRA.java:290)
at com.objectdb.o.WSM.US(WSM.java:113)
at com.objectdb.o.QRR.g(QRR.java:232)
at com.objectdb.o.QRR.b(QRR.java:151)
at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:665)
at point.Main.main(Main.java:52)
ryan.gustafson
ryan.gustafson's picture
Joined on 2011-09-29
User Post #2
#2
2011-10-02 13:59

Thank you for this bug report and for the test. Version 2.3.1 fixes the exception.

Some performance tips for this test:

  • You can improve persist performance by using smaller transactions (commit per 50,000 objects) rather than one very large transaction of one million objects (because it would consume less RAM).
  • You can improve query performance by retrieving field values rather than entity objects (when applicable) because of the overhead of instantiating entity objects.
  • Make sure your classes are enhanced.
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #642
#3
2011-10-03 07:23

Thanks for the quick turn around, I'll try out 2.3.1.

In regards to the tips:

  • Yes I noticed this when I started pushing things into the millions, and had already modified accordingly.  I also noticed a flaw in my use of the generated 'id' before 'commit'.  This caused the ID lookups on non-existent entities to be "slow" due to an internal exception (thrown and caught I think) according to my profiler.  Once I fixed my test, the ID lookups are 5x+ faster on existent entities.
  • Ok, good to know.  I've already looked into enabling level 2 caching, to see how that affects things.  The full object is likely to be our common use case, rather than a projection.
  • I had made changes to use a configuration XML, and was running with agent="true" on JDK 6, so hopefully that's good enough.  I need to look into it more.

I'd like to look closer into the JPAB code, see what it actually tests.  I'm basically comparing ObjectDB JPA against ehcache lookups/queries.

 

ryan.gustafson
ryan.gustafson's picture
Joined on 2011-09-29
User Post #3
#4
2011-10-09 00:13

Build 2.3.1_04 includes a more complete fix for this problem (following issue #74).

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

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