571 words

Issue #74 - ClassCastException thrown when running count query

BugVersion: Priority: NormalStatus: FixedReplies: 6
#1
2011-10-08 20:47

Hello!

Attached you find a full stacktrace.

The query was:

SELECT COUNT(t) FROM Position t
WHERE ((t.unit = :unit165w7ppbtu9ao AND t.receiveTime >= :receiveTimes232ne30kd42)
AND (t.latitude > :latitudehjgtlyt6s6dg AND t.longitude > :longitude14pwryko038jd))

The strange thing is that it only happens with certain values for the unit parameter. It's limited to some (not all!) of the newer units i have inserted. I'm currently evaluating your product. So i insert and delete a lot of data. I also tried to run your DB Doctor. It doesn't help.

Please contact me if you need more informations.

Regards

Ralph Moser

mosi0815
mosi0815's picture
Joined on 2011-10-08
User Post #1
#2
2011-10-08 21:27

The exception is in code that was modified in the last build 2.3.1_03. Although I don't see how the change is relevant - you may want to try running your test with build 2.3.1.

It would be very helpful if you can provide a test database + parameters that cause the exception (possibly in a support ticket if you can share the database but you don't want to make it public).

If it is not possible - please provide more information, particularly:

  • Index definition for the fields in the query.
  • Log of the query execution using DEBUG logging level.
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #654
#3
2011-10-08 21:16

Hello again!

I had the same issue with 2.3.1_02. I updated after the bug occoured.

After some experimenting i found a way for you to reproduce the crash.
If you open the attached db with the explorer and run the query below it will crash with the exception in crash.txt.

SELECT p FROM Position p WHERE p.unit.unitID = :id

:id = 101

The exception looks different (embedded vs server mode) but i think it has the same reason.

Please keep the database confidential!

Regards

Ralph

mosi0815
mosi0815's picture
Joined on 2011-10-08
User Post #2
#4
2011-10-08 22:25

It doesn't look as the same exception.

At least this one seems to be related to broken references. The Doctor detects many broken references in this database. Notice that currently ObjectDB doesn't enforce reference integrity and it is the application responsibility to avoid deletion from the database of objects that are still referenced by other objects.

Can I run the first query on this database? Could you please provide the parameter values for getting the first exception?

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #655
#5
2011-10-08 22:42

I could fix ObjectDB to return correct results for the second query (even though there are broken references).

The first query also runs well now with parameters 0, 0, 0, Unit#2074.

Please provide additional parameters for testing the first query and if the problem is solved a new build with the fix will be produced.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #656
#6
2011-10-08 23:11

The orphan Position records are there because i deleted some Units with a DELETE Query. Then i realized that the cascade option in the entity class is ignored when doing DELETE. I then tried to delete the orphans. Without success.

Try this query:

DELETE FROM Position p WHERE p.unit IS NULL

It doesn't delete anything. If you try it with SELECT nothing get's returned.

It's even getting better:

SELECT p FROM Position p WHERE p.unit IS NOT NULL

This query produces a null pointer exception.

Now back to the count query:

SELECT COUNT(t) FROM Position t
WHERE ((t.unit = :unit AND t.receiveTime >= :receiveTime)
AND (t.latitude > :latitude AND t.longitude > :longitude))

Try this parameters:

latitude and longitude = 0.001
unit = Unit#1974
receiveTime = 0

The result is this error:

Query Execution Error
=====================
com.objectdb.o.RFV cannot be cast to com.objectdb.o.CMV

If we can sort out this problems i will swich my project to your product. It's really fast.

mosi0815
mosi0815's picture
Joined on 2011-10-08
User Post #3
#7
2011-10-08 23:43

Please try build 2.3.1_04 that should fix these exceptions.

For the following query to take effect:

DELETE FROM Position p WHERE p.unit IS NULL

You first have to run the Doctor in fix mode and that will replace broken references with null values (because broken references are not null values).

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

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