hibernate转数据库问题(mysql 5 转到 sqlserver)
以下是我的配置文件,用mysql的时候没问题,用sqlserver的时候就有了问题.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>
<session-factory>
<!-- properties -->
<!--
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/NEWSDB?useUnicode=true&characterEncoding=utf8</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="show_sql">true</property>
-->
<property name="connection.username">sa</property>
<property name="connection.url">jdbc:microsoft:sqlserver://localhost;database=NEWS</property>
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="show_sql">true</property>
<!-- mapping files -->
<mapping resource="org/woden/news/Cate.hbm.xml"/>
<mapping resource="org/woden/news/News.hbm.xml"/>
</session-factory>
</hibernate-configuration>
ps:程序我完全没改...sqlserver连接是成功的,因为我设置了show_sql,控制台能成功显示sql语句,而sql语句我拿到sqlserver中执行也是成功的...极度郁闷!高手帮忙...
Hibernate: insert into CATE (NAME, DESCRIPTION, PARENT_ID) values (?, ?, ?) select scope_identity()
java.lang.Exception: Addition Exception
Addition Exception是我DAO中add类抛出的错误...