[jboss-user] [EJB 3.0] - Re: How to get this (very simple) tutorial to work in JBoss

waynebaylor do-not-reply at jboss.com
Thu May 17 12:03:17 EDT 2007


Okay, here's what I would try:

Use the Session Facade Pattern.

Create a stateless session bean and inject the EntityManagerFactory into it using the code you have in your servlet class (cut and paste it). Get a reference to this bean in your servlet using JNDI lookup:

InitialContext ctx = new InitialContext();
  | FacadeBeanLocal bean = ctx.lookup("FacadeBean/local");
  | bean.doWhatever();

The lookup string will vary depending on your packaging.
Using and EAR: "<ear-name>/<bean-name>/[local | remote]"
Using a JAR: "<bean-name>/[local | remote]"

Make sure you label the interface your facade bean implements with either @Local or @Remote.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046541#4046541

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046541



More information about the jboss-user mailing list