Hi John
Just add the parameters like you normally would when using #bind on its own,
like so:
queryParameters.put( "thing1", new Integer(9) );
queryParameters.put( "thing2", new Timestamp( ... ) );
Jurgen
-----Original Message-----
From: John Huss
Sent: Thursday, October 3, 2019 12:12 AM
To: [email protected]
Subject: MappedSelect/SQLTemplate #chain and #chunk directives
Looking at the docs
<https://cayenne.apache.org/docs/4.0/cayenne-guide/#queries> for
MappedSelect/SQLTemplate I'm not clear on how to supply the parameters for
the #chain and #chunk directives from the java side. How should I structure
this data and pass it to the SQLTemplate query?
SQL:
#chain('OR' 'AND')
#chunk($thing1) thing1 = #bind($thing1, 'INTEGER') #end
#chunk($thing2) thing2 >= #bind($thing2, 'TIMESTAMP') #end
#end"
Java:
Map<String, Object> queryParameters = *new* HashMap<>(2);
queryParameters.put(*?*);
MappedSelect<MyEntity> query = MappedSelect.*query*(MyDataMap.
*MYQUERY_QUERYNAME*, MyEntity.*class*).params(queryParameters);
Thanks.