不会吧,hibernate官网上都是这么解释的: Hibernate doesn't work with my MS SQL 2000 JDBC driver?(Glen Stampoultzis)If you're using Hibernate with the Microsoft SQL Server 2000 JDBC driver chances are you'll run into this problem:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC] Can't start a cloned connection while in manual transaction mode.Simply add SelectMethod=Cursor; to your connection string. There's a MS knowledge base article with more information. The Microsoft SQL Server 2005 JDBC driver has been certified by JBoss Inc.地址:http://www.hibernate.org/120.html
C3P0 using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=yt
Connection properties: {user=sa, password=****}
autocommit mode: false
MLog clients using java 1.4+ standard logging.
在服务器启动的时候,为什么还有autocommit mode: false这句呢?
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=yt;SelectMethod=cursor;
请问,这个怎么说呢?配置transaction 为什么会错了,为什么第一次又成功了?
Hibernate doesn't work with my MS SQL 2000 JDBC driver?(Glen Stampoultzis)If you're using Hibernate with the Microsoft SQL Server 2000 JDBC driver chances are you'll run into this problem:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]
Can't start a cloned connection while in manual transaction mode.Simply add SelectMethod=Cursor; to your connection string. There's a MS knowledge base article with more information. The Microsoft SQL Server 2005 JDBC driver has been certified by JBoss Inc.地址:http://www.hibernate.org/120.html
资源用完一定要记得关闭
<!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.url">
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=yt;SelectMethod=cursor;
</property>
<property name="connection.username">sa</property>
<property name="connection.password"/>
<property name="connection.driver_class">
com.microsoft.jdbc.sqlserver.SQLServerDriver
</property>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<!-- 在控制台显示SQL语句 -->
<property name="show_sql">true</property>
<!-- 配置C3P0连接池属性 -->
<property name="hibernate.connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider
</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.timeout">50000</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">false</property>
<!-- 配置持久化映射文件 -->
<mapping resource="com/ORM/Memberlevel.hbm.xml"/>
<mapping resource="com/ORM/Merchandise.hbm.xml"/>
<mapping resource="com/ORM/Admin.hbm.xml"/>
<mapping resource="com/ORM/Orders.hbm.xml"/>
<mapping resource="com/ORM/Cartselectedmer.hbm.xml"/>
<mapping resource="com/ORM/Cart.hbm.xml"/>
<mapping resource="com/ORM/Leaveword.hbm.xml"/>
<mapping resource="com/ORM/Category.hbm.xml"/>
<mapping resource="com/ORM/Member.hbm.xml"/>
</session-factory>
</hibernate-configuration>
<!--映射Merchandise到Category的多对一单向关联-->
<many-to-one class="com.ORM.Category" column="Category" lazy="false" name="category" not-null="true"/>Category.hbm.xml
<hibernate-mapping>
<class name="com.ORM.Category" table="category">
<id name="id" type="java.lang.Integer">
<column name="ID"/>
<generator class="identity"/>
</id>
<property name="cateName" type="java.lang.String">
<column length="40" name="CateName"/>
</property>
<property name="cateDesc" type="java.lang.String">
<column length="65535" name="CateDesc"/>
</property>
</class>
</hibernate-mapping>
你把if (!Hibernate.isInitialized(list))Hibernate.initialize(list); 去掉估计就没错了,这里又开了一个statement应该还是url的问题,就是那个SelectMethod.
org.hibernate.exception.JDBCConnectionException: could not load an entity: [com.ORM.Category#1]
你的表是不是对应有相关的外键什么的了