• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Which method is called?

 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which method is called when the bean goes back into the pool, after an entity bean is deleted from the database?

My immediate answer was ejbREmove() but the more i read words like 'after' i get more confused
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out HFE Chapter 6, question-16 (page number 371). Hope this would clarify your doubt.

Happy learning!
 
Rahul Mishra
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No No...see the Question has the following Scenario...

You go an delete the entity from the Database...that is a particular row..

there is a bean instance corresponding to the row...

will ejbRemove() be called on its own....because...if i go by Question 16...and the bean attempts to call an ejbLoad() it will throw an Exception..ObjectNotFound..because the object has been delted...

I could be wrong..only if i am reading the Question wrong...

Now tell me..
 
Balaji VR
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remember, the beans will get passivated (where ejbStore() gets called and data from bean gets persisted into DB and lock is released!) After that ONLY, you can go and play with DB in straight! Here there is no point of contact exists between BEAN & DB (beacause the bean is passivated and returned to pool!)

Is that makes sense!
 
Balaji VR
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And if you are trying to delete the same entity bean (where just before calling remove, you did a direct delete!). YES! Here you will get a ObjectNotFoundException
 
Rahul Mishra
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But still the anwser of Question 16 wont fit here

The Question reads...which method is called after the entity bean is deleted?

if the question was "which method is called /may be called before deleting an entity bean..?"Bingo..we had a winner...

But since Entity bean was removed....so ejbActivate(),ejbLoad(), ejbRemove() have already been called, data has been deleted...Bean instance..is now in the pool...the Question reads ..now what?
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the answer is... "nothing is called" after it has been deleted.
before deletion ejbRemove() is called.
 
Police line, do not cross. Well, this tiny ad can go through:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic