Try Component.getInstance(entityManager, true)
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4079880#4079880
Reply to the post :
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4079880
___
jboss-user
Good idea, I tried it but got
| 21:11:46,928 ERROR [STDERR] Exception in thread Thread-21
| 21:11:46,928 ERROR [STDERR] java.lang.IllegalStateException: No application
context active
| 21:11:46,928 ERROR [STDERR] at
org.jboss.seam.Component.forName(Component.java:1690)
|
An SMPC is in the conversation scope always as the ManagedPersistenceContext
component is annotated @Scope(CONVERSATION).
Anyway, look at ContextualHttpServletRequest for how to set up and tear down
the context.
View the original post :
Why don't u use EJB3 timers? You can create timer that will do ur
housekeeping work, and it will survive redeploys and server shutdown.
Besides, in this case EM will be accessible automatically.
try something like this
@Stateless
| @Name(jobsTimer)
| public class JobsTimerIMPL implements
Use Seam managed timers. 1) Simple timers (default, don't persist across
application restart), 2) EJB3 (do persist - but this can be not the beehaviour
you want), 3) Quartz (don't persist, good business interval support)
View the original post :
May be this can work
Lifecycle.beginCall();
| Component.getInstance(entityManager, true)
| Lifecycle.endCall();
I used that in MDB to get some seam components...
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4079938#4079938
Reply to the post :
I thought about using timers but got discouraged when in the spec it says
anonymous wrote :
| While timer durations are express in millisecond units, this is because the
millisecond is the unit of time granularity used by the API...it is expected
that most timed events will correspond to
Thanks for the suggestions, I tried the beginCall() ... endCall() on the
lifecycle and yes that does work, I can get an EntityManager in my thread
however back to the original problem, the entity manager has not started a
transaction for me, so nothing gets posted to the db and when I flush I
Thanks guys for all your help, I learnt a lot on this thread.
In the end I just wrote a SLSB using a @PersistenceContext annotation to get my
EntityManager then I just did a lookup via JNDI in the housekeeping thread to
get it then called a write method on it passing the object requiring the