On Feb 21, 2008, at 7:18 PM, majohnst wrote:
> I am trying to create a Quartz job that saves some data to my
> database. The
> quartz process is working correctly and my jobs runs, I can just
> never get
> the data committed to my database.
> In my job, I call an EJB3 that accesses my EntityManager. The
> method in my
> EJB is marked with
> and I can access the UserTransaction by injecting it into my bean by
> protected UserTransaction ut;
If you turn on level="fine" or "finer" logging, you'll see when
transactions are started and completed.
> When I call my method, the UserTransaction says that it is active. I
> persist my object to the EntityManager. When the quartz job is done,
> the new
> data was never committed to the database. So I tried to manually
> commit the
> usertransaction at the end of my method by using ut.commit(), but
> then I get
> an error:
> "Can't commit outside of a transaction. Either the
> is missing or the transaction has already been committed or rolled
The logging message would show whether the issue is the transactions
not begin/committing(), or if the EntityManager is failing to register
with the transaction (or commit or similar).
> So how can I manage transactions in an EJB3 outside of a webpage
There's no difference between a webpage request and something like a
quartz job with the exception of the context classloader. The
transactions should be starting the same in both cases.
> View this message in context:
> Sent from the Resin mailing list archive at Nabble.com.
> resin-interest mailing list
resin-interest mailing list