datanucleus-rdbms icon indicating copy to clipboard operation
datanucleus-rdbms copied to clipboard

Provide support for JDOQL/JPQL parameter mapped to multiple SQL statement parameters

Open andyjefferson opened this issue 2 years ago • 0 comments

If we want to have a statement like SELECT ... FROM MYTABLE WHERE MYCOL IN (?,?,?,?,?, ...) we could allow the input of a single JDOQL / JPQL parameter that is a Collection / array, and each element maps to a JDBC parameter. The JDOQL could be something like SELECT FROM mydomain.MyClass WHERE :myParam.contains(this.field) and myParam is passed in as a Collection.

One way would be to internally name the parameters as myParam#0, myParam#1, ... myParam#N. The benefit of this feature is very limited since it is simply trying to make the SQL statement reusable, but that only applies when the Collection has the same number of elements.

andyjefferson avatar May 05 '22 14:05 andyjefferson