2012-01-18 93 views
1

我是Spring Roo的新手。我试图使用两个数据库(Mysql)。我已经修改了Persistence.xml,如下所示。多个数据库春季Roo

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 
<persistence-unit name="persistenceUnit1" transaction-type="RESOURCE_LOCAL"> 
     <provider>org.hibernate.ejb.HibernatePersistence</provider> 
     <properties> 
      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/> 
      <!-- value="create" to build a new database on each run; value="update" to modify an existing database; value="create-drop" means the same as "create" but also drops tables when Hibernate closes; value="validate" makes no changes to the database --> 
      <property name="hibernate.hbm2ddl.auto" value="validate"/> 
      <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.DefaultNamingStrategy"/> 
      <property name="hibernate.connection.charSet" value="UTF-8"/> 
      <!-- Uncomment the following two properties for JBoss only --> 
      <!-- property name="hibernate.validator.apply_to_ddl" value="false" /--> 
      <!-- property name="hibernate.validator.autoregister_listeners" value="false" /--> 
     </properties> 
    </persistence-unit> 
<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL"> 
     <provider>org.hibernate.ejb.HibernatePersistence</provider> 
     <properties> 
      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/> 
      <!-- value="create" to build a new database on each run; value="update" to modify an existing database; value="create-drop" means the same as "create" but also drops tables when Hibernate closes; value="validate" makes no changes to the database --> 
      <property name="hibernate.hbm2ddl.auto" value="create"/> 
      <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/> 
      <property name="hibernate.connection.charSet" value="UTF-8"/> 
      <!-- Uncomment the following two properties for JBoss only --> 
      <!-- property name="hibernate.validator.apply_to_ddl" value="false" /--> 
      <!-- property name="hibernate.validator.autoregister_listeners" value="false" /--> 
     </properties> 
    </persistence-unit> 
</persistence> 

我已经改变了数据库性能和应用相应-context.xml .....

我的问题是如何做数据库逆向工程的同时存在于数据库中的表?

回答

1

也许你可以尝试在两个不同的Roo项目中对数据库进行逆向工程并将它们合并在一起。

您将不得不编写一个自定义持久层来处理其余的问题。

一切顺利。