• Post Reply Bookmark Topic Watch Topic
  • New Topic

remove in HOME Interface  RSS feed

 
Lakshmi Anantharaman
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that remove in the Component Interface actually removes the bean (Session/ Entity - row ). What does remove in the Home interface do ? Geting confused by too much learning .... (Just started preparing for the SCBCD )
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Home interfaces act as object creation factories and they define bean life cycle methods, like create, remove, find, etc. The container gets a bean instance from the pool in order to service home methods; this saves the overhead of creating unnecessary bean objects. This could also be a very efficient way to remove rows, without finding the corresponding beans and calling remove on their remote interface. It is also very useful for removing beans when the handler is passed.
The funny story is that because both entity and session bean home interfaces extend the EJBHome interface they will also get the implementation for remove methods. There are two of them: one that works for entity ejbs only and takes a pk and another one that takes an ejb handler. Because session beans don�t have pks, calling the remove and passing a fake pk will mostly force the container to throw an exception (check your container documentation for that).
Regards.
 
Lakshmi Anantharaman
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting ... Thanks
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!