I ended up using the InitialContext to lookup the EntityManagerFactory. Not sure if
this is the correct way or not but it works. Below is the new code.
// Example of getting EJB 3.0 beans from EJB 2.1 Session Bean.
public List findPosts(String userLogin) throws Exception
{
InitialContext initialContext = new InitialContext();
Object obj = initialContext.lookup("java:/imEjb30Factory");
EntityManagerFactory entityManagerFactory = (EntityManagerFactory)obj;
EntityManager entityManager = entityManagerFactory.createEntityManager();
Query query = entityManager.createNamedQuery("findPosts");
query.setParameter(1, userLogin);
List list = query.setMaxResults(10).setFirstResult(0).getResultList();
return(list);
}
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043997#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...