• 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

EJB how to?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell me how session beans call entity beans to make transactions?
I use WebLogic 6.1 plus JBuilder7.0.
Thanx in advance!
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can you tell me how session beans call entity beans to make transactions?


Do you mean "transactions" as in "I want to rollback if something goes wrong" or as in "I am doing some operation that the regular folks call a transaction"? I am assuming the latter...
1) Get an InitialContext. If the beans are in the same application, a simple new InitialContext() should do (otherwise you'll need to give some configuration parameters to the constructor).
2) Make a JNDI lookup for the entity bean's home interface. This could be done either by using the full JNDI name (e.g. "ejb/com/mycompany/ejbs/MyEntityBean"), or a logical JNDI name (e.g. "java:comp/env/ejb/MyEntityBean"). This depends on your ejb-jar.xml.
3) Use the home interface for creating/finding the entity you want
4) Invoke methods on the entity bean.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic