• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

EJB-QL

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

can somone explain about prameteres usage in EJB-QL
eg: in SELECT DISTINCT OBJECT(o) FROM Order o,IN(o.lineItems)l WHERE l.product.name=?1.how this is called.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be called from a finder method defined in the home interface like this for example:
public Order findByProductName(String name);
Hope I understood your question
/Magnus
 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi bhargavi,
The way parameters work is EJB-Ql is as follows. In a query you use ?# as a placeholder for parameters. When the query is evaluated each ?# will be replaced by a parameter from the associated method. The number following the ? determines which parameter will replace it. For example ?2 will be replaced by the second parameter. The number of ?#s can not exceed the number of method parameters but can be less.
Let's assume your query
SELECT DISTINCT OBJECT(o) FROM Order o,IN(o.lineItems)l WHERE l.product.name=?1

is associated with the finder method
public Product findByProductName(String name);
?1 would be replaced by the first parameter which is name.

Hope this helps.
 
bhargavi kakarala
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Keith & Magnus
I got it
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic