Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

[jboss-user] [JBoss Seam] - using import.sql with multiple
 datasources

scott.stark@jboss.org

2007-06-15


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:@(protected)>
   <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
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.