Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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.
 
My cellmate was this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic