• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about entity bean

 
Li Xin
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
In HF EJB book, page 142, it says "the server uses only one bean to represent a particular entity", however, in the book Mastering EJB by Ed Roman, page 114, it says "Several Entity Bean Instances May Represent the Same Underlying Data", so which one is correct?
Thanks.
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good question
The difference is in the definition of "bean" vs. "bean *instance*". A "bean" is a bean type, like, "CustomerBean". But several different CustomerBean *instances* might be used by the Container for a given underlying entity (in other words, a given underlying Customer).
The spec plays a little loose with that terminology--most of the time, we don't have to make a distinction between the word "bean" and the phrase "bean instance", but sometimes it does matter.
The main time the difference matters is when we talk about bean *removal* where an entity bean is *removed* and a particular Customer bean is *deleted* even though the actual underlying bean *instance* just goes back into the pool, and is never actually destroyed. The conceptual entity (say, the bean representing Fred Smith) is *removed* but the bean *instance* is not.
cheers,
Kathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic