• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFEJB Q16 page 371

 
Walker Rustin
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question:
Which additional method(s) might the container call when invoking ejbRemove?
A: ejbFind()
B: ejbLoad()
C: ejbStore()
D: ejbActivate()
E: ejbPassivate()
Answer is: B,D
My query is why C is not an answer?
thanks.
-Walk Rustin
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm.. if you're removing an entity (a row in a db), why would you want to store it?
 
Van Nguyen
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Walker,
the container calls ejbStore() when it wants to be in sync (bean vs. entity) but since you are deleting the entity and "zeroing out" the bean and putting it back into the pool, you don't care what the state of the bean is, thus you need to write it's state back to the entity.
let's say you did call ejbStore() to update the state in the db ... then you would turn around and delete the same row from the db? wasted effort.
Hope this helps.
-van
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic