Don,
Glad to hear that you got this working.  Since it sounds like you are using
application-managed EntityManagers, then you should have two choices to get
your PersistenceContext associated with your BMT.  As you have found out,
you can start the BMT before creating the EM.  This is the easiest, but it
may not always be optimal.  The other alternative is to use the
EM.joinTransaction() method.  You may want to try this out as an alternative
solution.

Thanks,
Kevin

On 1/7/07, Don Brady <[EMAIL PROTECTED]> wrote:

Michael Dick wrote:
>
> If you lookup the UserTransaction in your Session Bean, then your
> approach
> should work. I tried making the Feature Pack sample application a BMT
> bean
> and it seemed to work for me.  I can send you the application if you'd
> like.
>
> If the transaction is started prior to looking up a  BMT bean, then it
> will
> be suspended before the bean method
> executes. I don't know much about web services, this might not be the
> case
> or possible.

Michael and Craig and Kevin,

I got it to work!  Thanks very much for the help.

My error was in failing to start the Transaction *prior to* creating
the EntityManager.   Once I did that, it worked.

I should have realized that  OpenJPA needed to have the Global
Transaction already started by the time it looks to see if it is running
in a Transaction context.

As Craig mentioned,  this BMT approach is a very nice pattern to have
working, because it allows me to pass the underlying error back to the
Web Service caller, rather than just the non-specfic
TransactionRolledBackException from a CMT bean.

Thanks,

Don



Reply via email to