Null value was assigned to a property of primitive

HTTP ERROR: 500

Null value was assigned to a property of primitive type setter of channel.Channel.lft; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of channel.Channel.lft

RequestURI=/wanghuiCMS/admin/articleChannelRight.action
Caused by:

org.springframework.orm.hibernate3.HibernateSystemException: Null value was assigned to a property of primitive type setter of channel.Channel.lft; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of channel.Channel.lft
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:676)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:913)
at util.dao.HibernateDaoImpl.findAll(HibernateDaoImpl.java:113)
at channel.ChannelAction.articleChannelRight(ChannelAction.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)




原因:数据库字段值为NULL,int 类型不能赋值为NULL,只能为0,但有些实际应用中,如学生分数,0表示0分,NULL,则表示暂无分数所以,要不设数据字段不为NULL,要不就是用Integer.

你可能感兴趣的:(java,DAO,Hibernate,orm,sun)