Query fails with numerical values > 2^31

#1

Hi !

I'm trying to execute the following query (from Java-code, also tried ObjectDB Explorer)

delete from DataRecord p where p.TimeOfDeletion < 4147483648

This fails with "invalid numerical literal".

The field p.TimeOfDeletion is of type long.

As far as I know, the maximum value greater than 2^31 (Oracle: "The long data type is a 64-bit two's complement integer.")

In the database, typical values of '1410521074995' are stored. So, it is possible to store this big numbers.

But, why is my DELETE-statement failing me with numbers above 2147483648 ?

Any ideas?

 

Thanks for helping,

BG,

Jeroen

stacktrace:

Exception in thread "Thread-2" [ObjectDB 2.5.6_05] DELETE FROM DataRecord c WHERE c.TimeOfDeletion >  ==> 1410521635503 <==
javax.persistence.PersistenceException
Invalid numeric literal '1410521635503' (error 713)
(position 53) at com.objectdb.jpa.JpaQuery.executeUpdate(JpaQuery.java:795)
at dataprovidertest.DataMaintenanceThread.run(DataMaintenanceThread.java:58)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.objectdb.o.UserException: Invalid numeric literal '1410521635503'
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.TKR.u(TKR.java:489)
at com.objectdb.o.TKR.r(TKR.java:137)
at com.objectdb.o.TKI.<init>(TKI.java:53)
at com.objectdb.o.QSP.<init>(QSP.java:77)
at com.objectdb.o.QPR.K(QPR.java:1080)
at com.objectdb.o.QPR.<init>(QPR.java:103)
at com.objectdb.o.QRC.<init>(QRC.java:127)
at com.objectdb.o.QRM.Vb(QRM.java:271)
at com.objectdb.o.MST.Vb(MST.java:961)
at com.objectdb.o.WRA.Vb(WRA.java:311)
at com.objectdb.o.WSM.Vb(WSM.java:115)
at com.objectdb.o.QRR.g(QRR.java:247)
at com.objectdb.o.QRR.f(QRR.java:153)
at com.objectdb.jpa.JpaQuery.executeUpdate(JpaQuery.java:776)
... 2 more
#2

Thank you for this report.

Regarding numeric literals ObjectDB follows the Java syntax, so 4147483648 is invalid but 4147483648L is valid. We should probably follow SQL syntax as well and allow 4147483648.

Anyway, please check if adding L suffix to the long number (4147483648L) solves the error.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Yeah, adding 'L' works great (both in code as well as in the Explorer) !

 

Maybe add this in the online help (e.g. http://www.objectdb.com/java/jpa/query/jpql/delete#Selective_Deletion_) ?

Thanks for your quick support,

Have a nice weekend,

Jeroen.


Post Reply

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