Is it possible to call entity bean in session bean? If so, how?

Is it possible to call entity bean in session bean? If so how do I call?
It is possible to call and entity bean from a session bean. In fact, that is generally what you need to do. You will want a session bean tier containing application logic which uses the entity beans for data access. Calling an entity bean from a session bean is pretty fundamental, so you will probably want to get a good book or do an EJB tutorial (http://java.sun.com/j2ee/tutorial/1_3-fcs/index.html). In short, a session bean is like any other client. You will want to do a JNDI look up on the EntityBean home and then call one of the create() or finder methods. Then you can call whatever methods on the EntityBean you need.
This was first published in January 2002

Dig deeper on Service-oriented architecture (SOA) Design



Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: