javasqldatanucleusjdoql

Java Datanucleus is it possible to use the sql in operator with JDOQL


I am new to datanucleus.

Is it possible to use the Sql in operater ind JDOQL in datanucleus?

I want to use declerative JDOQL but I cannot figure out how to create a query that does what the SQL In Operater does.

SQL Query would look like this:

SELECT * FROM table WHERE id IN (1,2,3,4,5)

Thanks for helpful information


Solution

  • Why would JDOQL allow some random bit of SQL? JDOQL uses Java syntax, consequently the most logical Java syntax is Collection.contains so you pass in a Collection parameter which has those 5 elements, and do

    :param.contains(id)
    

    Obviously looking at the JDO spec would tell you that, and DataNucleus does nothing different.