[jboss-user] [EJB 3.0] - Re: EntityManagerFactory not injected?

akomulai do-not-reply at jboss.com
Sun Jan 21 18:36:32 EST 2007


Oh no... just found this from project Glassfish FAQ:

Q. Can I use javax.persistence.Persistence.createEntityManagerFactory() to get hold of an EntityManagerFactory in my web application? 

Yes, but this is not recommended because javax.persistence.Persistence.createEntityManagerFactory() is designed for use in a Java SE environment. In a Java EE environment, you can use dependency injection or JNDI lookup to access an EntityManagerFactory or an EntityManager as discussed earlier in this FAQ. Having said that, if you are using a web container like Tomcat 5.x which does not support Java Persistence API, then you have no option but to use this API. In such a case, we recommend you choose a container like GlassFish which supports the latest spec. 

I'm using JBoss 4.0.5 which uses Tomcat 5.5 as web container. I guess it's goodbye JPA then? Do I have any alternatives left if I'm going to continue using JBoss?

What a mess :(

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

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



More information about the jboss-user mailing list