Please explain me followin EJB-QL Query which is using finder method.. ============== <ejb-ql>SELECT MAX(l.lineItemId) FROM Account AS a, IN (a.accountLineItem) l WHERE l.accountId=?1</ejb-ql> ============
Please explain me ?? Also pls tell me wat is lineItemId, Account & accountLineItem Here??? Which one from above table names & Bean_interfaces names??? I have copied this query from a web page but can't understand it.
Every EJB-QL expression must have a SELECT (indicating what must be returned) and a FROM clause (indicating which beans are being worked with). The WHERE clause is optional.
SELECT MAX(l.lineItemId) FROM Account AS a, IN (a.accountLineItem) l WHERE l.accountId=?1
Select the max value of the lineItemId field (from the accountLineItem collection entries), FROM the Account bean (which in this query will be known by the short format a) , IN the accountLineItem collection (which in this query will be known by the short format l) WHERE the lineItems to be worked with must only be for the accountId that matches the supplied finder method parameter.
I might not have been clear about the IN section of the query above - it is used to identify that the query must look at all the items that exist in a collection in the bean.
The AS clause is used to assign a short name for the AbstractSchema name that can be used in the query besides the AbstractSchema name.
Chris [ January 19, 2006: Message edited by: Chris Brat ]