Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

an question from mock exam

 
Tom Chen
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic