I'm trying to pass an array of Category
POJOs to the query using IN
in the SQL:
public ShareObject[] search(String name, Category[] categories) {
...
OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>("SELECT FROM ShareObject WHERE name LIKE ? AND categories IN ?");
List<ODocument> result = db.command(query).execute(name, categories);
This will return an empty list. If I change the SQL to the following I get a result:"SELECT FROM ShareObject WHERE name LIKE ? AND categories IN [#10:0,#10:1]"
I also tried this, without sucess:
OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>("SELECT FROM ShareObject WHERE name LIKE ? AND categories IN ?");
List<ODocument> result = db.command(query).execute(name, new String[] { "#10:0", "#10:1" });
Try this code:
OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>("SELECT FROM ShareObject WHERE name like ? AND categories IN (?)");
List<ODocument> result = db.command(query).execute(name,"[#10:0,#10:1]");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With