Null value was assigned to a property of primitive type setter

org.springframework.orm.jpa.JpaSystemException: Null value was assigned to a property of primitive type setter of com.eshore.ismp.order.entity.HandSiOrder.siSize; nested exception is org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.eshore.ismp.order.entity.HandSiOrder.siSize

at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:310)

at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:221)

at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:417)

at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)

at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)

at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodIntercceptor.invoke(CrudMethodMetadataPostProcessor.java:122)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

at com.sun.proxy.$Proxy56.findAll(Unknown Source)

at com.eshore.ismp.order.process.OrderWebProcessor.queryManualOrderData(OrderWebProcessor.java:686)

at com.eshore.ismp.order.process.MercyOrderWebTest.queryManualOrderData(MercyOrderWebTest.java:31)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)

at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)

at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:70)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)

at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)

at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Caused by: org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.eshore.ismp.order.entity.HandSiOrder.siSize

at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:108)

at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:707)

at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:371)

at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:4463)

at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:186)

at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:134)

at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1103)

at org.hibernate.loader.Loader.processResultSet(Loader.java:960)

at org.hibernate.loader.Loader.doQuery(Loader.java:910)

at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)

at org.hibernate.loader.Loader.doList(Loader.java:2516)

at org.hibernate.loader.Loader.doList(Loader.java:2502)

at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332)

at org.hibernate.loader.Loader.list(Loader.java:2327)

at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490)

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)

at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)

at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1247)

at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)

at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:264)

at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getResultList(CriteriaQueryCompiler.java:254)

at org.springframework.data.jpa.repository.support.SimpleJpaRepository.readPage(SimpleJpaRepository.java:498)

at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:397)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:436)

at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:421)

at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:393)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)

... 38 more

Caused by: java.lang.IllegalArgumentException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:65)

... 73 more

解决办法,int类型的字段加上默认值,或者在实体类上用Integer表示

时间: 2024-12-21 03:59:11

Null value was assigned to a property of primitive type setter的相关文章

Null value was assigned to a property of primitive type setter of

解决办法: bean里的int 类型替换成 Integer .hbm.xml  改为java.lang.Integer Null value was assigned to a property of primitive type setter of,布布扣,bubuko.com

[hibernate]org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter

org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.wa.dataprocess.query.model.AcrossDeptApply 包装类和基本数据类型的区别, 包装类默认为null,基本类型为0. public class AcrossDeptApply implements Serializable private Str

Null value was assigned to a property of primitive type setter of"原因及解决方法

原文:http://blog.csdn.net/kevinzhangfei/article/details/6995316 总结:在Java中使用大写的数据类型. 在action请求数据的过程中报出"Null value was assigned to a property of primitive type setter of"错误,搜索之后发现是因为数据库里相应的字段为NULL. 例如: Java代码 <!--Hibernate映射文件中的字段--> <prope

org.hibernate.PropertyAccessException:Null value was assigned to a property of primitive type setter

在项目开发中遇到下面的异常:org.hibernate.PropertyAccessException:Null value was assigned to a property of primitive type setter ofcom.atguigu.surveypark.model.Page.orderno 这个异常的解释是:      Null值被分配给了设置为基本类型的Page类里的orderno属性.也就是说Null是不能分配给基本数据类型的.解决办法:手动给数据库中是Null值的

[转]Null value was assigned to a property of primitive type setter of&quot;原因及解决方法

原文地址:http://blog.csdn.net/kevinzhangfei/article/details/6995316 在action请求数据的过程中报出"Null value was assigned to a property of primitive type setter of"错误,搜索之后发现是因为数据库里相应的字段为NULL. 例如: Java代码 <!--Hibernate映射文件中的字段--> <property name="pri

Null value was assigned to a property of primitive type setter of cn.itcast.oa.domain.Forum.topicCount

[引用http://m.blog.csdn.net/blog/u013998070/41087351] Null value was assigned to a property of primitive type setter of cn.itcast.oa.domain.Forum.topicCount 2014-11-13阅读376 评论0 最近做一个OA项目,其中有一个论坛管理的版块,起初在实体类Forum只有几个字段,在数据库中也有对应的数据,在页面显示时,完全没有任何问题:但是后来在

Null value was assigned to a property of primitive type setter of。

前段时间,写了个方法,测试的时候报错了.Null value was assigned to a property of primitive type setter of.百度了一下,发现是hibernate的问题.sqlserver数据库中,字段类型为float,类中用float类型,那么,hibernate不允许数据库中的这个字段值为null. 解决方法:类中字段类型改为 Float 类型--float的封装类. 原文地址:https://www.cnblogs.com/wensy/p/88

null value was assigned to a property of primitive type setter of原因解决方法

原理如下: Integer与int的区别: Integer是对象.     因此可以为null(对象可以为空.),即property   =   null;      int   是普通类型, 不可以为null. 数据库中的property是空的,可以映射额外integer类型,但是不能映射为int类型,如果误在实体中将property定义成了int类型,就有可能会出这种错误. 解决方法: 把数据库中的数据删除,重新录入. 或者 将实体中对应property修改为integer类型.

org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of 异常

在开发项目的过程中,发现如下异常: 原因是updateType字段为int类型,不能接收null,而在数据库中对应的字段为null,解决方法:将updateType字段类型改为Integer.