SSH中Hibernate连接MySQL数据库问题
我用的是Struts2.16和Hibernate3.0。程序连接数据库的时候出现获取SessionFactory的时候出现错误。
hibernate.cfg.xml文件
<?xml version="1.0" encoding="GBK"?>
<!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.MySQLDialect</property>
<property name="connection.url">jdbc:mysql://localhost:3306/collab</property>
<property name="connection.username">root</property>
<property name="connection.password">123456</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="myeclipse.connection.profile">com.mysql.jdbc.Driver</property>
<property name="current_session_context_class">thread</property>
<property name="format_sql">true</property>
<property name="show_sql">true</property>
<mapping resource="com/zd/permission/ado/entity/user.hbm.xml" />
</session-factory>
</hibernate-configuration>
user.hbm.xml文件
<?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">
<!--
Document : user.hbm.xml
Created on : 2012年7月20日, 上午11:09
Author : CGL
Description:
Purpose of the document follows.
-->
<hibernate-mapping>
<class name="com.zd.permission.ado.entity.User" table="users">
<id name="id" column="id" type="java.lang.Integer">
<generator class="increment"/>
</id>
<property name="userName" column="uName" type="java.lang.String"/>
<property name="userPassword" column="uPassword" type="java.lang.String" />
<property name="userSex" column="uSex" type="java.lang.String" />
<property name="userDuty" column="uDuty" type="java.lang.String" />
<property name="userEmail" column="uEmail" type="java.lang.String" />
<property name="userDepartment" column="uDepartment" type="java.lang.String" />
<property name="userRoles" column="uRoles" type="java.lang.String" />
</class>
</hibernate-mapping>
------解决方案--------------------
最好把错误信息也贴出来吧、
贴完整点。