[jboss-user] [JBoss Seam] - using import.sql with multiple datasources
sysex
do-not-reply at jboss.com
Fri Jun 15 14:53:35 EDT 2007
I am developing a Seam application in conjunction with my client who is writing a proprietary CMS system, in which the data access entities will be embedded in the principal app. My requirement is to have two datasources: mysql and oracle. One being for user registration and the other to provide site content.
I realize that there are many outstanding CMS solutions that provide data access as a service; but... since this approach was not my decision, let's avoid recommending a different architecture :)
My problem is that their CMS database schema is generated on the fly from the EJB's so it is necessary to import data after deployment. My problem is that there doesn't seem to be a way to specify to Hibernate which datasource should attempt to read and import the contents of import.sql. My error output would imply that both datasources attempt to load import.sql.
If specificity is not an option I may have to manually update to datasource element to not "drop-create" and import the test data manually. I would rather avoid this if possible though.
Here are my configuration files. Again, I am using Seam.
--------------------------------------------------------------------------------
persistence.xml
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<persistence 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_1_0.xsd"
version="1.0">
<persistence-unit name="entityManager" transaction-type="JTA">
org.hibernate.ejb.HibernatePersistence
<jta-data-source>java:/OracleLocalDS</jta-data-source>
</persistence-unit>
<persistence-unit name="someclient">
org.hibernate.ejb.HibernatePersistence
<jta-data-source>java:/someclientDatasource</jta-data-source>
</persistence-unit>
--------------------------------------------------------------------------------
jboss-ds.xml
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<local-tx-datasource>
<jndi-name>someclientDatasource</jndi-name>
<connection-url>jdbc:mysql://localhost/someclient</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>user</user-name>
pwd
</local-tx-datasource>
<local-tx-datasource>
<jndi-name>OracleLocalDS</jndi-name>
<connection-url>jdbc:oracle:thin:@localhost:1521</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>user</user-name>
pwd
</local-tx-datasource>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054877#4054877
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054877
More information about the jboss-user
mailing list