Matthieu-
If you set the openjpa.ConnectionFactoryName to the JNDI name of a
DataSource, then Kodo will use that.
See: http://incubator.apache.org/openjpa/docs/latest/manual/
manual.html#ref_guide_dbsetup
On Dec 13, 2006, at 4:21 PM, Matthieu Riou wrote:
> Thanks Marc! And what about the datasource? Is there another
> equivalent
> interface and property to use?
>
> On 12/13/06, Marc Prud'hommeaux <[EMAIL PROTECTED]> wrote:
>>
>> Matthieu-
>>
>> If you have a custom TransactionManager, you can tell Kodo to
access
>> it using a ManagedRuntime implementation (see http://
>> incubator.apache.org/openjpa/docs/latest/javadoc/org/apache/
openjpa/
>> 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: "org.apache.openjpa.ee.JNDIManagedRuntime
>> (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 http://
svn.apache.org/
>> viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/
>> apache/openjpa/ee/AutomaticManagedRuntime.java?
>> view=markup&pathrev=468504 ).
>>
>> See also: http://incubator.apache.org/openjpa/docs/latest/manual/
>> manual.html#ref_guide_enterprise_trans
>>
>>
>>
>>
>> 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
>>
>>