Interesting, I'm not using EJB3.0 - I'm using Spring so all I need is to
get my ApplicationContext and I'm off and running. The LazyInitEx is
definately related to walking the object graph after the session is
closed.
My guess is that putting Work on the queue doesn't get container objects
injected into it - you will probably need to get them some other way.
Sorry - I don't know how to do that - anyone else?
Brian
----- Original message -----
From: "Dobes Vandermeer" <dobesv_at_gmail.com>
To: users_at_glassfish.dev.java.net
Date: Tue, 3 Feb 2009 11:39:37 -0800 (PST)
Subject: Re: Queueing jobs for processing in their own thread/transaction?
Okay, this looked really good but I'm having trouble accessing the database
inside my Work object.
The errors I'm getting are:
org.hibernate.LazyInitializationException: could not initialize proxy - no
Session
or
IllegalArgumentException: entity not in the persistence context
Strangely I am not re-using objects from the other thread (that I know of) I
get the object using em.get() and then try to use that object.
Is there anything special I need to do in the Work object to set up the
persistence context and session? Does it need to construct its own copy of
the stateless beans and EntityManager somehow?