• 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
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

valid EJB QL query

 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a question from the final mock exam of HFEJB. I am going for exam tomorrow morning, so it will be greatly appreciated if someone can answer this before tomorrow morning (to be more specific, in around 7 hours from now on)

The Q58 of HFEJB:
Given CMP beans CustomerBean(CB), OrderBean(OB) and LineItemsBean(LIB) with relationships:
CB(1) -> OB(n)
OB(1) -> LIB(n)

Which will return set of customers that have orders?
Correct answer given is:
select distinct object(c) from Customer c, Order o where c.custnum=o.custnum.

How is this a valid query??? Customer to Order is 1 to many, so the right query should be
select distinct object(c) from Customer c, IN (c.Order) o;

See the similar example given on page 236 of the spec?

Can someone please check and comment on this?
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another such question, whose answer is confusing me:

Q.65 Which cases can cause SB instance to be destroyed without container calling ejbRemove() method?

One of the correct options given is:
An inactive client timed out while bean is in passivated state.

Here shall it be client timed out or bean timed out?
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ankith both are correct.

select distinct object(c) from Customer c, Order o where c.custnum=o.custnum.

actually intension of using relationship is to retrieve data from more than one table.a well formed queury always should work whether it is one-one one-many. and EJB-QL is replica of Standard SQL except some oo benifits like traversing..etc.. so above ejb-query will give the expected result.
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic