关于hibernate中多个数据源数据传输的使用:
1.首先需要配置文件:
oracle:oracle.cfg.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@ip:1521:orcl</property> <property name="hibernate.connection.username">username</property> <property name="hibernate.connection.password">password</property> <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql">true</property> <property name="hibernate.hbm2ddl.auto">none</property> <property name="hibernate.jdbc.fetch_size">100</property> <property name="hibernate.jdbc.batch_size">30</property> <!-- 配置二级缓存 --> <property name="hibernate.cache.use_second_level_cache">false</property> <property name="hibernate.cache.use_query_cache">false</property> <!-- Hibernate4 这里和Hibernate3不一样 要特别注意!!!--> <property name="hibernate.cache.region.factory_class">org.hibernate.cache.EhCacheRegionFactory</property>