You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by ostwdd <os...@strauss-it-consulting.de> on 2013/03/09 15:29:03 UTC

connecting to multible databases

How can I connect to multible databases?

persistence.xml allows only one persistence-unit tag under geronimo.

thx

Olaf



--
View this message in context: http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp7583055.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: connecting to multible databases

Posted by Pinaki Poddar <pp...@apache.org>.
See if the following OpenJPA module called Slice meets your requirement

[1]
http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#ref_guide_slice



-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp7583055p7583257.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: connecting to multible databases

Posted by José Luis Cetina <ma...@gmail.com>.
I mean in the @Table annotation not in @Entity


2013/3/12 José Luis Cetina <ma...@gmail.com>

> I connect to multiple databases using multiple persistence units and in
> each entity define the schema in the entity annotation. Did you try this?
> El 12/03/2013 05:38, "ostwdd" <os...@strauss-it-consulting.de>
> escribió:
>
> Hello Rick,
>>
>>
>>
>> thx, but this doesn’t work with managed transactions.
>>
>>
>>
>> Any idea?
>>
>>
>>
>> Olaf
>>
>>
>>
>> Von: Rick Curtis [via OpenJPA]
>> [mailto:ml-node+s208410n7583088h17@n2.nabble.com]
>> Gesendet: Montag, 11. März 2013 20:49
>> An: ostwdd
>> Betreff: Re: connecting to multible databases
>>
>>
>>
>> Define multiple persistence units?
>>
>> Thanks,
>> Rick
>>
>>
>> On Sat, Mar 9, 2013 at 8:29 AM, ostwdd <[hidden email]>wrote:
>>
>>
>> > How can I connect to multible databases?
>> >
>> > persistence.xml allows only one persistence-unit tag under geronimo.
>> >
>> > thx
>> >
>> > Olaf
>> >
>> >
>> >
>> >
>> >
>>
>> --
>> *Rick Curtis*
>>
>>
>>
>>   _____
>>
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>>
>> http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp75830
>> 55p7583088.html<http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp7583055p7583088.html>
>>
>> To unsubscribe from connecting to multible databases, click here
>> <
>> http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscr
>>
>> ibe_by_code&node=7583055&code=b3N0b2V3ZXJAc3RyYXVzcy1pdC1jb25zdWx0aW5nLmRlfD<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7583055&code=b3N0b2V3ZXJAc3RyYXVzcy1pdC1jb25zdWx0aW5nLmRlfD>
>> c1ODMwNTV8MTAwNzk1MTkzMQ==> .
>>
>> <
>> http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=macro_vi
>>
>> ewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.Basic
>>
>> Namespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.
>>
>> NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_e
>> mails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>>
>> NAML
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp7583055p7583094.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>


-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: AW: connecting to multible databases

Posted by José Luis Cetina <ma...@gmail.com>.
I connect to multiple databases using multiple persistence units and in
each entity define the schema in the entity annotation. Did you try this?
El 12/03/2013 05:38, "ostwdd" <os...@strauss-it-consulting.de> escribió:

> Hello Rick,
>
>
>
> thx, but this doesn’t work with managed transactions.
>
>
>
> Any idea?
>
>
>
> Olaf
>
>
>
> Von: Rick Curtis [via OpenJPA]
> [mailto:ml-node+s208410n7583088h17@n2.nabble.com]
> Gesendet: Montag, 11. März 2013 20:49
> An: ostwdd
> Betreff: Re: connecting to multible databases
>
>
>
> Define multiple persistence units?
>
> Thanks,
> Rick
>
>
> On Sat, Mar 9, 2013 at 8:29 AM, ostwdd <[hidden email]>wrote:
>
>
> > How can I connect to multible databases?
> >
> > persistence.xml allows only one persistence-unit tag under geronimo.
> >
> > thx
> >
> > Olaf
> >
> >
> >
> >
> >
>
> --
> *Rick Curtis*
>
>
>
>   _____
>
> If you reply to this email, your message will be added to the discussion
> below:
>
>
> http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp75830
> 55p7583088.html
>
> To unsubscribe from connecting to multible databases, click here
> <
> http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscr
>
> ibe_by_code&node=7583055&code=b3N0b2V3ZXJAc3RyYXVzcy1pdC1jb25zdWx0aW5nLmRlfD
> c1ODMwNTV8MTAwNzk1MTkzMQ==> .
>
> <
> http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=macro_vi
>
> ewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.Basic
>
> Namespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.
>
> NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_e
> mails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML
>
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp7583055p7583094.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: connecting to multible databases

Posted by Kevin Sutter <kw...@gmail.com>.
You'll need to describe your scenario a bit more...  Rick's suggestion of
using multiple PU definitions is definitely one way of incorporating
multiple databases.  If you are trying to use multiple resources within a
single transaction, then you'll either need to use XA transactions (2PC),
or possibly use separate transactions for each resource.  This latter case
can be done using the openjpa.Connection2* properties.  Datasources defined
by these Connection2 properties utilize resource local transactions that
are independent from any enclosing transaction.  This is very helpful for
accessing the database for automatic id generation -- independent from the
other business related transaction processing.

Hope this helps,
Kevin

On Tue, Mar 12, 2013 at 6:38 AM, ostwdd
<os...@strauss-it-consulting.de>wrote:

> Hello Rick,
>
>
>
> thx, but this doesn’t work with managed transactions.
>
>
>
> Any idea?
>
>
>
> Olaf
>
>
>
> Von: Rick Curtis [via OpenJPA]
> [mailto:ml-node+s208410n7583088h17@n2.nabble.com]
> Gesendet: Montag, 11. März 2013 20:49
> An: ostwdd
> Betreff: Re: connecting to multible databases
>
>
>
> Define multiple persistence units?
>
> Thanks,
> Rick
>
>
> On Sat, Mar 9, 2013 at 8:29 AM, ostwdd <[hidden email]>wrote:
>
>
> > How can I connect to multible databases?
> >
> > persistence.xml allows only one persistence-unit tag under geronimo.
> >
> > thx
> >
> > Olaf
> >
> >
> >
> >
> >
>
> --
> *Rick Curtis*
>
>
>
>   _____
>
> If you reply to this email, your message will be added to the discussion
> below:
>
>
> http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp75830
> 55p7583088.html
>
> To unsubscribe from connecting to multible databases, click here
> <
> http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscr
>
> ibe_by_code&node=7583055&code=b3N0b2V3ZXJAc3RyYXVzcy1pdC1jb25zdWx0aW5nLmRlfD
> c1ODMwNTV8MTAwNzk1MTkzMQ==> .
>
> <
> http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=macro_vi
>
> ewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.Basic
>
> Namespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.
>
> NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_e
> mails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML
>
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp7583055p7583094.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

AW: connecting to multible databases

Posted by ostwdd <os...@strauss-it-consulting.de>.
Hello Rick,

 

thx, but this doesn’t work with managed transactions.

 

Any idea?

 

Olaf

 

Von: Rick Curtis [via OpenJPA]
[mailto:ml-node+s208410n7583088h17@n2.nabble.com] 
Gesendet: Montag, 11. März 2013 20:49
An: ostwdd
Betreff: Re: connecting to multible databases

 

Define multiple persistence units? 

Thanks, 
Rick 


On Sat, Mar 9, 2013 at 8:29 AM, ostwdd <[hidden email]>wrote: 


> How can I connect to multible databases? 
> 
> persistence.xml allows only one persistence-unit tag under geronimo. 
> 
> thx 
> 
> Olaf 
> 
> 
> 
> 
> 

-- 
*Rick Curtis* 



  _____  

If you reply to this email, your message will be added to the discussion
below:

http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp75830
55p7583088.html 

To unsubscribe from connecting to multible databases, click here
<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscr
ibe_by_code&node=7583055&code=b3N0b2V3ZXJAc3RyYXVzcy1pdC1jb25zdWx0aW5nLmRlfD
c1ODMwNTV8MTAwNzk1MTkzMQ==> .
 
<http://openjpa.208410.n2.nabble.com/template/NamlServlet.jtp?macro=macro_vi
ewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.Basic
Namespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.
NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_e
mails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML 





--
View this message in context: http://openjpa.208410.n2.nabble.com/connecting-to-multible-databases-tp7583055p7583094.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: connecting to multible databases

Posted by Rick Curtis <cu...@gmail.com>.
Define multiple persistence units?

Thanks,
Rick


On Sat, Mar 9, 2013 at 8:29 AM, ostwdd <os...@strauss-it-consulting.de>wrote:

> How can I connect to multible databases?
>
> persistence.xml allows only one persistence-unit tag under geronimo.
>
> thx
>
> Olaf
>
>
>
>
>
-- 
*Rick Curtis*