wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Can Session bean and Entity Bean talk?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can Session bean and Entity Bean talk??" Watch "Can Session bean and Entity Bean talk??" New topic
Author

Can Session bean and Entity Bean talk??

rastin purr
Ranch Hand

Joined: Jul 20, 2002
Posts: 73
Hi there guys,
I am not clear about a few points. Can someone kindly clearify it for me please. Thanks!
I presume a session bean can lookup for an entity bean. Is that correct? I need to lookup an entity bean from a stateless session bean. Is that possible? I keep a copy of the entity bean home interface in the session bean. Should I keep it as the home interface or its home handle? I presume both are possible. If so which is better? I get the home reference duing the setSessionContext method of the session bean is that correct? I make methods call through the home interface in the business method of the session bean, is that allowed?
Anyone know if the above could be tested using Forte for Java 4.0 Ide? It could generate a test module. Any ideas how to test it?
I have problems with the above. I created the entity bean tested it and it works fine but when it home methods was called from a session bean business methods, it throws exception TransactionRolledBack exception it was thrown from the setEntityContext of the entity bean. Is it that the context is null? the error message is just "null". It wouldn't allow me to call any home methods of entity bean from the session bean business method. It it something to do with the transaction? The trasactions are cmt "requred" (default).
Please help. Thanks a lot Java Rangers
Ras
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Try reading this article and this article. Also, taking a look at a good introductory EJB book like Ed Roman's or Richard Monson-Haefel's might help.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
rastin purr
Ranch Hand

Joined: Jul 20, 2002
Posts: 73
Hi Kyle,
Thanks for the advice. The two articles are great.
ras
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can Session bean and Entity Bean talk??