Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Inject EntityManagerFactory on @Webservlet


Luciano,

What JPA package are you using? It should be responsible for handling the injections ...

Jan
On 22 June 2011 15:18, Luciano Greiner <luciano.greiner@xxxxxxxxx> wrote:
Hello.

 I am coding a small webapp with the help of Maven and Jetty. I'm
having a hard time trying to inject the EntityManagerFactory inside a
Servlet (@Webservlet):

@WebServlet("/test")
public class TestServlet extends HttpServlet {

       @PersistenceUnit(unitName="pu")
       private EntityManagerFactory emf;

       @Override
       protected void doGet(HttpServletRequest request, HttpServletResponse response)
                       throws ServletException, IOException {
          emf... // is null

       }

It's always null. In the other hand
Persistence.createEntityManagerFactory("pu") works.

Am i doing anything wrong here?

Thank you!

Luciano G Santos
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top