When ever i try to include two objects in my FROM clause. I get the following error:
OQLSyntaxException: An incorrect token type was found near , (45, need 0"
The OQL I am executing follows:
Select obj
FROM
com.sys.ilink.display.text.dataobject.TextDO obj,
com.sys.ilink.display.text.dataobject.VersDO versDO
where
obj.displayTxtId = $1 and
obj.locale = $2 and
versDO.displayTextId = obj.displayTextId
In the JDO FAQ it seems to suggest that this is allowed (shown bellow). Also in the OQL Advanced section the from clause clearly supports "from obj [, obj]".
When I tried to write the query the second way suggested "bellow", I got a ArrayIndexOutOfBoundsException: 1 exception when trying to query on something in the second object such as obj.versDO.effectiveDate < $1.
Any suggestions! Thanks,
Kevin M
I cannot get Castor OQL to join two objects for me. Is it supported?
Yes or no. Castor OQL supports implicit joins. And, in most case, you simply don't need explicit join.
Consider the following example,
SELECT o FROM Order o, LineItem i
WHERE o.id = i.id AND i.price > 100
It is simply equivalent to the following OQL
SELECT o FROM Order o,
WHERE o.lineItem.price > 100
