Hibernate配置
来源:互联网 发布:淘宝运费险保费 编辑:程序博客网 时间:2024/06/06 09:56
Hibernate的配置
*JDBC
1).src下hibernate.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="dialect">org.hibernate.dialect.Oracle9Dialect</property> <property name="connection.url">jdbc:oracle:thin:@localhost:1521:SZSX</property> <property name="connection.username">huyao</property> <property name="connection.password">sx</property> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="hibernate.hbm2ddl.auto">update</property> <property name="show_sql">true</property> <mapping resource="net/sxif/vote/entity/Entity.hbm.xml"/> </session-factory></hibernate-configuration>
2).entity内
<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"><hibernate-mapping package="net.sxif.vote.entity"><class name="VoteItem" table="VoteItem" lazy="false"><id name="id" type="java.lang.Integer"><column name="voteItem_id" sql-type="Number(25)"></column><generator class="sequence"><param name="sequence">seq_voteItem_id</param></generator></id><property name="text" type="string"><column name="voteItem_text"></column></property><many-to-one name="voteContent" class="net.sxif.vote.entity.VoteContent" fetch="join"><column name="voteItem_voteContent"></column></many-to-one></class></hibernate-mapping>
* JNDI
<?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.datasource">java:comp/env/jdbc/huyao</property><property name="dialect">org.hibernate.dialect.SQLServerDialect</property><property name="hibernate.hbm2ddl.auto">update</property><property name="show_sql">true</property><mapping resource="com/szsx/huyao/login/model/UserModel.xml"></mapping><mapping resource="com/szsx/huyao/player/player_config/model/PlayerStatusModel.xml"></mapping><mapping resource="com/szsx/huyao/player/player_info/model/PlayerInfoModel.xml"></mapping><mapping resource="com/szsx/huyao/player/player_info/model/PlayerInfoSubModel.xml"></mapping><mapping resource="com/szsx/huyao/team/team_config/model/TeamStateModel.xml"></mapping><mapping resource="com/szsx/huyao/team/team_info/model/TeamInfoModel.xml"></mapping><mapping resource="com/szsx/huyao/game/game_info/model/GameInfoModel.xml" /><mapping resource="com/szsx/huyao/game/game_info/model/GameInfoSubModel.xml"></mapping><mapping resource="com/szsx/huyao/system/tag_info/model/TagInfoModel.xml" /></session-factory></hibernate-configuration>
- hibernate-hibernate的配置
- 【Hibernate】2.Hibernate配置
- Hibernate 配置!
- Hibernate配置
- Hibernate配置
- Hibernate 配置
- Hibernate配置
- Hibernate配置
- Hibernate配置
- Hibernate配置
- hibernate 配置
- Hibernate 配置
- Hibernate 配置
- hibernate配置
- 配置HIbernate
- Hibernate 配置
- Hibernate配置
- Hibernate配置
- ORACLE 11g进程
- NO.4凯撒密码
- MPIA demo_v1.3
- 【Transact-SQL】一个计算用电量的问题
- js获取当前页面的一些值,比如大小宽度等(借鉴)
- Hibernate配置
- 复习快速排序
- NO.90 Struts2.3.15.1升级总结
- Essential C++中文版——满汉全席之外
- android:仪表盘(简单易实现)
- PL/SQL表---table()函数用法
- Context泄漏:Handlers & Inner Classes
- JSR286 Portlet开发:Portlet之间的Events通信
- 再谈DOS批处理下格式化日期字符串的方法(详解)