Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

call entity from session bean

 
Arundhathi Menon
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey all,
Can u pls tell me how to call an entity bean from a session bean???should it be CMP or BMP??can u demonstrate with an example.
thank u
 
Sergiu Truta
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that the Session Beans and the Entity Beans are deployed on the same application server, the calling code inside the Session Bean would be:
EntityLocalHome entityLocalHome = (EntityLocalHome) context.lookup( JNDI_ENTITY_LOCAL_HOME );
EntityLocal entityLocal = (EntityLocal) entityLocalHome.findByPrimaryKey(entityPK);
OR
EntityLocal entityLocal = (EntityLocal) entityLocalHome.create(...);
Cheers
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35753
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arundhathi,
You call a CMP or BMP in the same way (as illustrated in the post above.) The session bean does not care which type of entity bean you are using.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!