2012-01-18 90 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項目中對數據庫進行逆向工程並將它們合併在一起。

您將不得不編寫一個自定義持久層來處理其餘的問題。

一切順利。