課程
/后端開發
/Java
/Hibernate初探之一對多映射
老師是從哪找的config.xml的?
2017-04-09
源自:Hibernate初探之一對多映射 2-2
正在回答
我在hibernate-release-4.3.0.Final包中找到的不能用,在其他的包里面找了一個?。?/p>
<!DOCTYPE hibernate-configuration PUBLIC
? ? ? ? "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
? ? ? ? "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
? ? <session-factory>
? ? ? ? <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
? ? ? ? <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
? ? ? ? <property name="hibernate.connection.username">sa</property>
? ? ? ? <property name="hibernate.connection.password"></property>
? ? ? ? <property name="hibernate.connection.url">jdbc:hsqldb:.</property>
? ? ? ? <property name="hibernate.cache.use_query_cache">true</property>
? ? ? ? <property name="hibernate.cache.region_prefix">hibernate.test</property>
? ? ? ? <property name="hibernate.jdbc.use_streams_for_binary">true</property>
? ? ? ? <property name="hibernate.jdbc.batch_size">0</property>
? ? ? ? <property name="hibernate.max_fetch_depth">3</property>
? ? ? ? <property name="hibernate.hbm2ddl.auto">create-drop</property>
? ? ? ? <property name="hibernate.generate_statistics">true</property>
? ? ? ? <property name="hibernate.cache.region.factory_class">org.hibernate.testing.cache.CachingRegionFactory</property>
? ? ? ? <mapping class="org.hibernate.ejb.test.Item"/>
? ? ? ? <mapping class="org.hibernate.ejb.test.Cat"/>
<mapping class="org.hibernate.ejb.test.Kitten"/>
? ? ? ? <mapping class="org.hibernate.ejb.test.Distributor"/>
? ? ? ? <class-cache class="org.hibernate.ejb.test.Item" usage="read-write"/>
? ? ? ? <collection-cache collection="org.hibernate.ejb.test.Item.distributors" usage="read-write" region="RegionName"/>
? ? </session-factory>
</hibernate-configuration>
在網上搜一個,修改為自己的數據庫信息就OK
舉報
Hibernate中一對多關聯映射配置,以及cascade和inverse屬性作用
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-05-28
我在hibernate-release-4.3.0.Final包中找到的不能用,在其他的包里面找了一個?。?/p>
<!DOCTYPE hibernate-configuration PUBLIC
? ? ? ? "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
? ? ? ? "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
? ? <session-factory>
? ? ? ? <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
? ? ? ? <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
? ? ? ? <property name="hibernate.connection.username">sa</property>
? ? ? ? <property name="hibernate.connection.password"></property>
? ? ? ? <property name="hibernate.connection.url">jdbc:hsqldb:.</property>
? ? ? ? <property name="hibernate.cache.use_query_cache">true</property>
? ? ? ? <property name="hibernate.cache.region_prefix">hibernate.test</property>
? ? ? ? <property name="hibernate.jdbc.use_streams_for_binary">true</property>
? ? ? ? <property name="hibernate.jdbc.batch_size">0</property>
? ? ? ? <property name="hibernate.max_fetch_depth">3</property>
? ? ? ? <property name="hibernate.hbm2ddl.auto">create-drop</property>
? ? ? ? <property name="hibernate.generate_statistics">true</property>
? ? ? ? <property name="hibernate.cache.region.factory_class">org.hibernate.testing.cache.CachingRegionFactory</property>
? ? ? ? <mapping class="org.hibernate.ejb.test.Item"/>
? ? ? ? <mapping class="org.hibernate.ejb.test.Cat"/>
<mapping class="org.hibernate.ejb.test.Kitten"/>
? ? ? ? <mapping class="org.hibernate.ejb.test.Distributor"/>
? ? ? ? <class-cache class="org.hibernate.ejb.test.Item" usage="read-write"/>
? ? ? ? <collection-cache collection="org.hibernate.ejb.test.Item.distributors" usage="read-write" region="RegionName"/>
? ? </session-factory>
</hibernate-configuration>
2017-04-09
在網上搜一個,修改為自己的數據庫信息就OK