Query with restrictions on parent's parent object.
Hi,
I'm trying to do a query using SQLQuery where I have a restriction on the template object I'm passing as an argument.
Query code looks like this:
{code} MyObjectGrandParent grandParent = new MyObjectGrandParent(); grandParent.setSomeValue(42);
MyObjectParent parent = new MyObjectParent(); parent.setGrandParent(grandParent);
MyObject qTemplate = new MyObject(); qTemplate.setParent(parent); qTemplate.setSomeOtherField("blah");
SQLQuery sqlQuery = new SQLQuery(qTemplate, "someOtherField = ? AND parent.grandParent.someValue = ?"); {code}
And I have also tried:
{code} SQLQuery sqlQuery = new SQLQuery(qTemplate, "someOtherField = ? AND parent.grandParent = ?"); {code}
But It just doesn't seem to work this way. When I add a restriction to MyObjectParent as well, then it works :? . But I don't want that since there may be multiple of those that match my search...
Any ideas?
{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2129]{quote}