persistence@glassfish.java.net

Re: NullPointerException in persist() method

From: edu53 <eduardoefigueroa_at_yahoo.com.ar>
Date: Wed, 7 Nov 2007 08:08:51 -0800 (PST)

Thnanks for your comments.
I' ll try tu check my configuration and see if it works.

Regards,
edu


Marina Vatkina wrote:
>
> Klaus,
>
> Changing from a resource injection to
> Persistence.createEntityManagerFactory
> means no JTA transactions, no persistence context propagation, and no LAZY
> loading (unless you do static weaving of your entities). So it's not an
> equal
> replacement.
>
> Also, if injection isn't working, GlassFish won't be able to pass Java EE
> compliance testing. So it's something with your setup that isn't quite
> right.
>
> Regards,
> -marina
>
> Klaus Unger wrote:
>> Hi,
>>
>> this is not a qualified response. I am also only a new user to
>> glassfish/toplink. Resource injection usually doesn't work for me in
>> toplink
>> aswell.
>>
>> You might want to use:
>>
>> EntityManagerFactory emf =
>> Persistence.createEntityManagerFactory("persistenceunit-name");
>> em = emf.createEntityManager();
>>
>> - Klaus
>>
>>
>> On Tuesday 06 November 2007 21:47:41 edu53 wrote:
>>
>>>Hi,
>>>I'm new using JPA (GlassFish V2 Server, TopLinks, NetBeans IDE) and have
>>>the following problem:
>>>In a managed bean that uses resource injection, i.e
>>>
>>>@PersistentContext
>>>private EntityManager em;
>>>
>>>When calling em.persist(entity) always get a
>>>java.lang.NullPointerException, no matter what entity trying to persist.
>>>I'm not sure if resource injection is working.
>>>
>>>
>>>Somebody can help ?
>>>Thanks in advance
>
>

-- 
View this message in context: http://www.nabble.com/NullPointerException-in-persist%28%29-method-tf4760965.html#a13630142
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.