org.hibernate.exception.GenericJDBCException: could not initialize a collection

wsasdaa 2010-06-20 08:12:48
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" 去掉 就好了 。
...全文
390 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
水中影子 2010-06-20
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 qiheia 的回复:]

lazy="true" 懒加载

lazy="false" 立即加载
[/Quote]

顶楼上
qiheia 2010-06-20
  • 打赏
  • 举报
回复
lazy="true" 懒加载

lazy="false" 立即加载

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧