Please, How do I can connect to more than one database in the same process?
I need to take some values from database A then after some process update in B
database, update database C too and finally update in database A.
Databases B and C are remote servers each one.
A lot of thanks.
On Domingo 06 Septiembre 2009 11:27:18 Martin Gainty escribió:
> pm-descriptors
>
>
> Specifies one or more persistence manager descriptors, but only one of
> them must be in use at any given time. If none are specified, the Sun
> CMP persistence manager is used.
>
> http://docs.sun.com/source/817-5049/decmp.html#wp37792
>
> pm-inuse defines whether its in-use or not
> http://docs.sun.com/source/817-6087/dgdesc.html#wp91606
>
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message
> est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
> > From: pmancheno_at_gmail.com
> > To: users_at_glassfish.dev.java.net
> > Date: Sun, 6 Sep 2009 10:40:12 -0500
> > Subject: How do I can use more than one Persistence Unit in Glassfish v3?
> >
> > Hi friends.
> >
> > How do I can use more than one Persistence Unit in Glassfish v3?
> >
> > I am using Glassfishv3 (with Netbeans6.8M1) and I wanna use more than one
> > persistence unit, my persistence.xml is:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> > http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
> > <persistence-unit name="VoiceMailProvider-ejbPU" transaction-type="JTA">
> > <jta-data-source>jdbc/__PostgreSqlPool</jta-data-source>
> > <class>org.pepo.entidades.etapa.Arquitectura</class>
> > <class>org.pepo.entidades.etapa.Comando</class>
> > <exclude-unlisted-classes>true</exclude-unlisted-classes>
> > <properties/>
> > </persistence-unit>
> > <persistence-unit name="Asterisk-ejbPU" transaction-type="JTA">
> > <jta-data-source>jdbc/__Asterisk</jta-data-source>
> > <class>org.pepo.entidades.otherDB.VoicemailUsers</class>
> > <exclude-unlisted-classes>true</exclude-unlisted-classes>
> > <properties/>
> > </persistence-unit>
> > </persistence>
> >
> > When I had just one PU then I wrote in my EJB:
> >
> > @PersistenceContext(name="FirstDB-ejbPU")
> > private EntityManager em;
> >
> > And everything was ok, now I am trying with:
> >
> > @PersistenceContext(name="FirstDB-ejbPU")
> > private EntityManager em_FirstDB;
> > @PersistenceContext(name="SecondDB-ejbPU")
> > private EntityManager em_SecondDB;
> >
> > But I receive the exception in the attach. I thing that there is
> > something wrong when I create the new entity because it try to use the
> > first Persistence Unit.
> >
> > How do I can use more than one Persistence Unit in Glassfish v3?
> >
> > A lot of thaks.
>
> _________________________________________________________________
> Windows Live: Make it easier for your friends to see what you’re up to on
> Facebook.
> http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:O
>N:WL:en-US:SI_SB_facebook:082009