• 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
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

an question from mock exam

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question is:
16. Which of the following are true about the Primary Key class in Entity EJB?
a. It is used for identifying an Entity BEan according to the Bean type, remote interface and Container Context
b. It is used for identifying an Entity BEan according to the Bean type, home interface and Container Context
c. The definition of the Primary Key can be deferred until deployment
d. The primary key should override the equals() and hashCode() methods of the Object class
e. The primary key class cannot define constructors
answer: b,c,d
Can someone explain why we should select b and c. (d is easy to understand)?
Thank you
 
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer for c: The definition of the Primary Key can be deferred until deployment
is explained in EJB's by Monson-Haefel, O'Reilly
2nd Ed page 160.
In the context he's talking about Sun's hope for a market in which to sell EJBs.
One problem with container-managed persistence in EJB 1.0 was that the bean developer had to define the primary key before the bean was deployed. In turn, this requirement forced the developer to make assumptions about the environment in which the bean would be used, and thus limited the bean's portability across databases.
 
Tom Chen
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rufus,
Thank you for your answer.
You only explained that the intention or Sun's hope to defer the definition of Primary Key class. Can you explain more about how to defer the definition so that the bean can be portable across database.
And how about answer b
Thank you,
Tom Chen

Originally posted by Rufus Bugleweed:
The answer for c: The definition of the Primary Key can be deferred until deployment
is explained in EJB's by Monson-Haefel, O'Reilly
2nd Ed page 160.
In the context he's talking about Sun's hope for a market in which to sell EJBs.
One problem with container-managed persistence in EJB 1.0 was that the bean developer had to define the primary key before the bean was deployed. In turn, this requirement forced the developer to make assumptions about the environment in which the bean would be used, and thus limited the bean's portability across databases.

 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, these would be opinions...
C. Oracle has this concept of a sequencer you can use to generate a primary key. Sybase has this concept of a timestamp. The two concepts are alike but different. If I set up with a Oracle implementation because it has a big market share then I'm making my sales pitch difficult to Sybase fans.
B. These three items are need to uniquely identify a bean from a primary key. Suppose your
primary key is 9987654. A bean in container A and container B could both have this same key. A given client could be working with same type entity beans in two containers. You would have two home interface objects to work with.
Two differnt types of entity bean could have 9987654 as the primary key.
You won't need to know this level of detail for the exam.
 
brevity is the soul of wit - shakepeare. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic