-
1. Re: 2 XA datasources USING JBoss
gonorrhea Jun 2, 2009 8:19 AM (in response to saurabhk.pixelsallover.s.gmail.com)from SiA book:
Using distributed transactions in a Seam application
One of the main reasons for using JTA transactions is to take advantage of distributed
transactions. Despite Seam wrapping global transactions around each request,
only the JTA implementation can support distributed transactions. In that case, you
can work with multiple persistence managers and get two-phase commits as long as
the underlying data source is configured as an XA resource. Chapter 14 (online) demonstrates
how to set up XA data sources in the sample application.go here: http://www.manning.com/dallen
Be advised that Oracle is XA-enabled out-of-the-box (not sure which version, but some co-workers told me this) and MSSQL is not...
-
2. Re: 2 XA datasources USING JBoss
saurabhk.pixelsallover.s.gmail.com Jun 2, 2009 8:33 AM (in response to saurabhk.pixelsallover.s.gmail.com)Thanks, thanks so much ........
please tell me wat do i need to do to have XA-enabled MSSQL.
Do you know any more tutorials...
-
3. Re: 2 XA datasources USING JBoss
freakwave10 Jun 2, 2009 10:51 PM (in response to saurabhk.pixelsallover.s.gmail.com)Hi,
you need to download the Mircrosoft jdbc 2.0 driver. (just google)
Then you need to execute the xainstall.sql script that comes with the jdbc download package.
Look at the end of the script to see how you add roles to your db user.
Then configure the seam app
1. create 2nd datasource entry in datasource (XA datasources) in the xxx-ds.xml
2. create 2nd persistence unit in the persistence-dev.xml
3. in the components.xml create the persistence manager context for both databases
4. in the components.xml create the converters for both databases (important for html table to database record mapping)
5. copy the sqljdbc.jar to the server/default/lib
e.g. components.xml<persistence:managed-persistence-context auto-create="true" name="entityManager" persistence-unit-jndi-name="java:/AudioConferenceEntityManagerFactory" /> <persistence:managed-persistence-context auto-create="true" name="msSqlEntityManager" persistence-unit-jndi-name="java:/AudioConferenceEntityManagerFactoryMsSql" /> <ui:entity-converter name="standardEntityConverter" entity-loader="#{standardEntityLoader}" /> <ui:jpa-entity-loader name="standardEntityLoader" entity-manager="#{entityManager}" /> <ui:entity-converter name="msSqlEntityConverter" entity-loader="#{msSqlEntityLoader}" /> <ui:jpa-entity-loader name="msSqlEntityLoader" entity-manager="#{msSqlEntityManager}" />
Kind regards,
Wolfgang
-
4. Re: 2 XA datasources USING JBoss
saurabhk.pixelsallover.s.gmail.com Jun 3, 2009 10:35 AM (in response to saurabhk.pixelsallover.s.gmail.com)Hi Mr.Wolfgang Bergbauer
I will explain you the problem in detail ... As i said earlier that I hav just started working on jboss(since last 20 days). I don't know much about it ..
Let me explain how I am goin about it .
First I am creating a Seam web project and establishing the conncetion with the oracle server and accesing the database in the oracle server ..
Then I am making the changes in the ds.xml file, presistence.xml, components.xml of the seam project that I made which is connected to the oracle database(adding the Mssql details in the files) as you stated ..
Is this the right approach to start??
and when I am adding the statements
<persistence:managed-persistence-context auto-create="true" name="msSqlEntityManager" persistence-unit-jndi-name="java:/EntityManagerFactoryMsSql" />
<ui:entity-converter name="msSqlEntityConverter" entity-loader="#{msSqlEntityLoader}" />
<ui:jpa-entity-loader name="msSqlEntityLoader" entity-manager="#{msSqlEntityManager}" />
It gives an error :The prefix "ui" for element "ui:entity-converter" is not bound.
Please let me know what to do
Thanks in Advance