前台报错
java.lang.ClassCastException: java.lang.Integer
org.hibernate.type.StringType.toString(StringType.java:44)
org.hibernate.type.NullableType.nullSafeSet(NullableType.java:89)
org.hibernate.type.NullableType.nullSafeSet(NullableType.java:58)
程序代码片段
MarketInfoCustomer customer = new MarketInfoCustomer();
customer.setMarketInfo(marketInfo);
customer.setCellNum(marketInfo.getCellNum());
customer.setStatus(MarketInfoCustomer.STATUS_WAIT);
customer.setCustomerInfo(customerInfo);
marketInfo.getCustomers().add(customer);
marketInfoCustomerDao.saveOrUpdate(customer);
marketInfoDao.saveOrUpdate(marketInfo);
配置文件:
MarketInfo.hbm.xml配置片段
<bag
name= "customers "
lazy= "true "
inverse= "true "
cascade= "all "
>
<key
column= "MARKET_INFO_ID "
>
</key>
<one-to-many
class= "com.m3china.market.pojo.MarketInfoCustomer "
/>
</bag>
请问各位大哥,这是什么问题啊,我怎么也搞不明白!
------解决方法--------------------------------------------------------
java.lang.Integer类型转换错误
------解决方法--------------------------------------------------------
应该是Integer转String错
用String.valueOf试试