openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Prud'hommeaux <>
Subject Re: Setting a datasource and a transaction manager
Date Wed, 13 Dec 2006 22:12:54 GMT

If you have a custom TransactionManager, you can tell Kodo to access  
it using a ManagedRuntime implementation (see http:// 
ee/ManagedRuntime.html ).

For example, if your TransactionManager is accessible via the JNDI  
name "comp/env/MyTransactionManager", then you could tell OpenJPA to  
access it by setting the "openjpa.ManagedRuntime" property to the  
value: " 
(TransactionManagerName=comp/env/MyTransactionManager)". For more  
exotic mechanisms of accessing the TransactionManager, you can just  
make a custom implementation of the ManagedRuntime class.

In the future, we intent to make this more standard by utilizing the  
new javax.transaction.TransactionSynchronizationRegistry mechanism,  
but for now, we have custom implementations for each of our known and  
supported application servers (see the code at 
view=markup&pathrev=468504 ).

See also: 

On Dec 13, 2006, at 1:13 PM, Matthieu Riou wrote:

> Hi JPA guys,
> In the Apache Ode podling we're currently working on replacing  
> Hibernate
> with OpenJPA. It's been working great so far but I have a couple of
> questions. I'd need to set the transaction manager and the datasource
> manually using the OpenJPA API and I've been unable to find the  
> right class
> and the right setters so far. Is there an easy way to do that?
> The use case is we need to run both in containers with their own tx  
> manager
> (like Geronimo) and lightweight containers (like Tomcat). In the  
> lightweight
> case we instantiate our own transaction manager (JOTM) and our own
> datasource (Minerva) and we don't need any JNDI (unnecessary painful).
> I've been looking around and haven't found an easy way. I could  
> have a look
> at the sources but I figured that asking you directly would be  
> quicker.
> Thanks!
> Matthieu

View raw message