[jboss-user] [Datasource Configuration] - xa-datasource x creating tables in both database
Luciano Borges
do-not-reply at jboss.com
Tue Jul 3 16:16:08 EDT 2012
Luciano Borges [https://community.jboss.org/people/lucianoborges] created the discussion
"xa-datasource x creating tables in both database"
To view the discussion, visit: https://community.jboss.org/message/745889#745889
--------------------------------------------------------------
Hi all,
I'm trying create a two-phase commit application, but, when the JBoss starts the app creates the table on both databases.
My -ds.xml
<datasources>
<xa-datasource>
<jndi-name>PostgreSQLXA1</jndi-name>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<xa-datasource-property name="ServerName">localhost</xa-datasource-property>
<xa-datasource-property name="PortNumber">5432</xa-datasource-property>
<xa-datasource-property name="DatabaseName">bd1</xa-datasource-property>
<xa-datasource-property name="User">postgres</xa-datasource-property>
<xa-datasource-property name="Password">postgres</xa-datasource-property>
<track-connection-by-tx></track-connection-by-tx>
</xa-datasource>
<xa-datasource>
<jndi-name>PostgreSQLXA2</jndi-name>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<xa-datasource-property name="ServerName">localhost</xa-datasource-property>
<xa-datasource-property name="PortNumber">5432</xa-datasource-property>
<xa-datasource-property name="DatabaseName">bd2</xa-datasource-property>
<xa-datasource-property name="User">postgres</xa-datasource-property>
<xa-datasource-property name="Password">postgres</xa-datasource-property>
<track-connection-by-tx></track-connection-by-tx>
</xa-datasource>
</datasources>
My persistence.xml
<persistence-unit name="database1-ds" transaction-type="JTA">
<jta-data-source>java:/PostgreSQLXA1</jta-data-source>
<class>example.twophasecommit.domain.Book</class>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
</properties>
</persistence-unit>
<persistence-unit name="database1-ds" transaction-type="JTA">
<jta-data-source>java:/PostgreSQLXA2</jta-data-source>
<class>example.twophasecommit.domain.BookSummary</class>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
</properties>
</persistence-unit>
Is there something wrong?
Thanks,
Luciano
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/745889#745889]
Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120703/d0798182/attachment.html
More information about the jboss-user
mailing list