org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.pure.domain.Member.setLogincount
org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:203)
[size=large]
根据错误提示,我发现可能是由于set方法是不是写错了,检查了好几遍,发现没有错,后来在网上找了一下,有前辈果然也遇到这种问题。[url]http://hi.baidu.com/nickshen3/blog/item/0dbbacc2d511701f0ef47727.html[/url]
exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of...
原因:查询结果中包含null的项 对于一些数字项包含null,定义该项时必须使用wrapper类型,而不能是primitive类型,例如使用Integer等,而不能是int否则会抛出exception!
解决:映射为int,double的字段,在建表时,某些int或者double字段的default 0,导致exception setting property value with CGLIB setter 这些字段出错.这些字段最后都有默认值.设置好默认值问题就可以解决了。[/size][size=x-large][color=red]
但我在平时发现在映射的时候,很多人用了包装类,这样即使出现null值,也不会出问题,但我不知道是设置default值好呢; 还是直接使用包装类,还请各位大哥指教。[/color][/size][size=medium]
org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.pure.domain.Member.setLogincount
org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:203)
org.hibernate.tuple.PojoTuplizer.setPropertyValues(PojoTuplizer.java:173)
org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2919)
org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:530)
org.hibernate.loader.Loader.doQuery(Loader.java:436)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
org.hibernate.loader.Loader.doList(Loader.java:1593)
org.hibernate.loader.Loader.list(Loader.java:1577)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
com.pure.dao.hibernate.MemberHibernateDAO$2.doInHibernate(MemberHibernateDAO.java:60)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:332)
com.pure.dao.hibernate.MemberHibernateDAO.getMemberList(MemberHibernateDAO.java:53)
com.pure.domain.logic.impl.MemberFacadeImpl.getMemberList(MemberFacadeImpl.java:38)
com.pure.web.spring.manager.member.MemberListController.memberList(MemberListController.java:66)
com.pure.web.spring.manager.member.MemberListController.handleRequest(MemberListController.java:31)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
[/size]