org.hibernate.PropertyAccessException: exception setting property value with CGL

 查询结果中包含null的项
 对于一些数字项包含null,定义该项时必须使用wrapper类型,而不能是primitive类型,例如使用Double、Float等,而不能是double、float否则会抛出如下错误:
 org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of org.hibernate.scott.Emp.setComm
 at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:203)
 at org.hibernate.tuple.PojoTuplizer.setPropertyValues(PojoTuplizer.java:173)
 at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2900)
 at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
 at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:506)
 at org.hibernate.loader.Loader.doQuery(Loader.java:415)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)
 at org.hibernate.loader.Loader.doList(Loader.java:1557)
 at org.hibernate.loader.Loader.list(Loader.java:1540)
 at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
 at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
 at org.hibernate.impl.SessionImpl.list(SessionImpl.java:791)
 at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
 at org.hibernate.scott.Main.viewAllScottSlow(Main.java:89)
 at org.hibernate.scott.Main.main(Main.java:129)
Caused by: net.sf.cglib.beans.BulkBeanException
 at org.hibernate.scott.Emp$$BulkBeanByCGLIB$$9815f405.setPropertyValues(<generated>)
 at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:200)
 ... 14 more
Caused by: java.lang.NullPointerException
 ... 16 more

你可能感兴趣的:(java,.net,Hibernate)