Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Please explain me following EJB-QL Query.....

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.

Please help me.

Thanx,
Prash
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi prash,

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.

This query

SELECT MAX(l.lineItemId) FROM Account AS a, IN (a.accountLineItem) l WHERE l.accountId=?1

says.

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 ]
 
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
?1 means the first argument in the method signature invoked by client( client means the component which invokes the entity EJB). ?2 stands for 2nd argument and so on
 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chris,

I m still confused with "accountLineItem" in the above query. U told dat is is collection.
Whether is ts the name of Table in Databse???

Thanx..

Prash
 
Pay attention! Tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic