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>