SSH三大框架整合项目中的错误

错误(并不是int非包装类型之类的问题):

HTTP Status 500 - exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.qst.giftems.gift.pojos.TGift.setTypeId; nested exception is org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.qst.giftems.gift.pojos.TGift.setTypeId

TGift.java

package com.qst.giftems.gift.pojos;

public class TGift {

private Integer id;


private Integer typeId;

private Integer sales;

private String pic;

private TGiftType type;


/** 款式集合 **/


private List<TGiftStyle> styles = new ArrayList<TGiftStyle>();


//用户集合


private Set<TUser> users = new HashSet<TUser>();


public Integer getId() {

return id;

}


public void setId(Integer id) {

this.id = id;

}


public Integer getTypeId() {

return typeId;

}


public void setTypeId(Integer typeId) {

this.typeId = typeId;

}


public Integer getSales() {

return sales;

}


public void setSales(Integer sales) {

this.sales = sales;

}


public String getPic() {

return pic;

}


public void setPic(String pic) {

this.pic = pic;

}


public TGiftType getType() {

return type;

}


public void setType(TGiftType type) {

this.type = type;

}


public List<TGiftStyle> getStyles() {

return styles;

}


public void setStyles(List<TGiftStyle> styles) {

this.styles = styles;

}


public Set<TUser> getUsers() {

return users;

}


public void setUsers(Set<TUser> users) {

this.users = users;

}

}

TGift.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">

<!--    Mapping file autogenerated by MyEclipse Persistence Tools-->

<!--  dynamic-insert="true" dynamic-update="true" -->

<hibernate-mapping>

   <class name="com.qst.giftems.gift.pojos.TGift" table="t_gift" 

catalog="gift_ems" lazy="false" > 

       <id name="id" type="java.lang.Integer">

           <column name="id" />

           <generator class="native" />

       </id>

       <many-to-one name="typeId" class="com.qst.giftems.gift.pojos.TGiftType" fetch="select">

           <column name="type_id" not-null="false">

               <comment>类型ID</comment>

           </column>

       </many-to-one>

       <property name="sales" type="java.lang.Integer">

           <column name="sales">

               <comment>该商品销售数量 </comment>

           </column>

       </property>

       <property name="pic" type="java.lang.String">

           <column name="pic" />

       </property>

       <!-- 配置与TUser的多对多关联关系 -->

       <set name="users" table="t_user_cart">

           <key>

               <column name="gift_id" >

                   <comment>礼品ID</comment>

               </column>

           </key>

           <many-to-many class="com.qst.giftems.user.pojos.TUser" column="user_id"/>

       </set>

       <set name="styles" inverse="true">

           <key>

               <column name="gift_id" not-null="true">

                   <comment>礼品ID</comment>

               </column>

           </key>

           <one-to-many class="com.qst.giftems.gift.pojos.TGiftStyle" />

       </set> 

   </class>

</hibernate-mapping>


qq_绿川夏_03247384
浏览 1340回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java