org.hibernate.exception.GenericJDBCException: could not initialize a collection
org.hibernate.exception.GenericJDBCException: could not initialize a collection: [com.chinacent.xbauto.bbs.entity.Busscartype.carinfos#3]
最后解决了
<?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">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.chinacent.xbauto.bbs.entity.Busscartype" table="busscartype" catalog="qichewang">
<id name="bctId" type="java.lang.Integer">
<column name="BCT_Id" />
<generator class="native" />
</id>
<set name="carinfos" inverse="true" lazy="false" >
<key>
<column name="BCT_Id" not-null="true" />
</key>
<one-to-many class="com.chinacent.xbauto.bbs.entity.Carinfo" />
</set>
</class>
</hibernate-mapping>
最后 将 lazy="false" 去掉 就好了 。