native sql queries

#1

Is there a way to run native SQL queries in ObjectDB?

I would guess 'no' since it is an oodbms, but I did not find the answer in the documentation.

An attempt:

    Query q = em.createNativeQuery("select * from person");

Result:

Exception in thread "main" [ObjectDB 2.3.0_02] Unexpected exception (Error 990) Generated by Java HotSpot(TM) 64-Bit Server VM 1.6.0_21 (on Windows 7 6.1).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: java.lang.UnsupportedOperationException: null
java.lang.UnsupportedOperationException at com.objectdb.jpa.EMImpl.createNativeQuery(EMImpl.java:925) at Fetch.main(Fetch.java:129)

/Fredrik

 

#2

Native SQL queries are not supported because there is no underlying RDBMS. But since SQL and JPQL are very similar it could be possible in future releases to support "native SQL". But JPQL is preferred so this feature would be in a low priority.

Anyway, the expected  UnsupportedOperationException should not be wrapped by InternalException (As shown in your report), so this should be fixed.

ObjectDB Support
#3

Thanks for the rapid answer.

/Fredrik

Reply