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

Hello.

I got hibernate-entitymanager on it

Luciano Greiner
(51) 81780200




On Wed, Jun 22, 2011 at 2:59 AM, Jan Bartel <janb@xxxxxxxxxxx> wrote:
>
> 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
>
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>


Back to the top