您的位置:首页 > 其它

hibernate设置

2015-12-18 15:13 246 查看
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
-->
<!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="dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/hiblicc</property>
<property name="connection.username">root</property>
<property name="connection.password">123456</property>

<!-- 导入映射配置文件 -->
<!-- 		<mapping resource="com/hiblicc/user/User.hbm.xml"/> -->
<mapping class="com.hiblicc.user.User"/>
</session-factory>
</hibernate-configuration>
<数据库连接信息>
1设置方言
2设置mysql驱动类
3设置数据库连接地址路径
4设置数据库登录用户名
5设置数据库登录密码
<导入映射配置>
<pre name="code" class="java"><mapping resource="com/hiblicc/user/User.hbm.xml"/>//这是是使用配置文件的配置
<pre name="code" class="java"><mapping class="com.hiblicc.user.User"/>使用注解直接把类写上





                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: