• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB QL

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Ranchers,
I have one doubt.
Can we select more than one cmp field in the EJB QL

For example If the abstract Person has firstName and lastName as CMP fields, can we have query such as

select p.firstName,p.lastName from Person p.

If this is allowed, I guess that some kind of separator must be used.
Ranchers, please share any details that you know about this.

Cheers,
Sandeep
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am assuming this is not possible because the ejbSelect methods can only return one value: a CMP field, a CMR field as a single entity or a group of CMR fields as a Collection. So, it doesn't seem logical to allow EJB-QL to return multiple fields from the SELECT.

Please correct if I am wrong, I haven't looked this up in the spec.
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sandeep MP:

select p.firstName,p.lastName from Person p.



Please read the EJB-QL specs. ****ONLY ONE **** cmp field can be returned from query. The return type of the SELECT clause can be one of the following:
1. The abstract schema of the entity bean that contains the select method.
2. The abstract schema of a related entity bean.
3. A persistent field

I am wondering why will anybody select just one field, when YOU can get whole LocalPerson interface object.

Cheers

Nishant
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic