hibernate 注解
来源:互联网 发布:vr软件 编辑:程序博客网 时间:2024/05/22 05:19
在配置文件中直接使用如下
<mapping class="com.bjsxt.hibernate.Husband"/>
<mapping class="com.bjsxt.hibernate.Wife"/>
在java中要使用如下来过的sessionfactory
Configuration cfg = new AnnotationConfiguration().configure();
SessionFactory sf=cfg.buildSessionFactory();
<?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="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
<property name="connection.username">jd</property>
<property name="connection.password">jd</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<!--
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:SXT</property>
<property name="connection.username">scott</property>
<property name="connection.password">tiger</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
-->
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<!-- Drop and re-create the database schema on startup
<property name="hbm2ddl.auto">update</property>
-->
<!-- -->
<mapping resource="com/bjsxt/hibernate/Student.hbm.xml"/>
<mapping resource="com/bjsxt/hibernate/StuIdCard.hbm.xml"/>
<mapping class="com.bjsxt.hibernate.Husband"/>
<mapping class="com.bjsxt.hibernate.Wife"/>
</session-factory>
</hibernate-configuration>
Configuration cfg = new AnnotationConfiguration().configure();
SessionFactory sf=cfg.buildSessionFactory();
- hibernate 注解
- hibernate注解
- hibernate注解
- hibernate注解
- Hibernate注解
- Hibernate 注解
- Hibernate注解
- hibernate注解
- hibernate 注解
- hibernate注解
- hibernate注解
- Hibernate注解
- hibernate注解
- hibernate注解
- hibernate注解
- Hibernate 注解
- hibernate注解
- Hibernate注解
- Windows删除语言栏多余的输入法
- 【好工具分享】时间管理利器——今目标
- C++中虚函数表的介绍
- ios tableview
- 151017下午测试的总结
- hibernate 注解
- opencv2-用迭代器访问图像像素
- linux 内存泄漏查找
- 生成带有目录的Markdown格式文档
- 不高兴的小明
- 自定义SwpieRefreshLayout(进入页面自动刷新,下拉刷新,点击加载更多)
- Android Studio 恢复小窗口停靠模式(Docked Mode)
- 归并排序求逆序对
- 我的第一个MapReduce程序(WordCount)