Hibernate学习笔记

来源:互联网 发布:松江的主机怎么编程 编辑:程序博客网 时间:2024/05/18 20:13

原作者:http://www.verydemo.com/demo_c146_i1361.html

<many-to-one name="person" column="person_id" fetch="join" lazy="false" unique="true"></many-to-one>

 

 

 

 

<property name="hibernate.hbm2ddl.auto">update</property>
 


 

 

 

下面以OSCache为例,配置二级缓存!

首先加入包OSCache的包oscache-2.1.jar和common-logging-1.1.1.jar包,当然每个人版本可以不一样。

oscache-2.1.jar在下面路径中

 

hibernate-distribution-3.6.0.Final\lib\optional\oscache

 

 

<!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.connection.driver_class">com.mysql.jdbc.Driver</property>        <property name="hibernate.connection.username">root</property>        <property name="hibernate.connection.password">njusc123</property>        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/xivadata</property><!--告诉hibernate所使用的数据库方言  --><property name="hibernate.dialect"…………………………………………………………………………
0 0