`
cn_arthurs
  • 浏览: 327148 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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 z.ma.eo.UserM1.updated_at
	at org.hibernate.property.DirectPropertyAccessor$DirectSetter.set(DirectPropertyAccessor.java:143)
	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:4255)
	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:995)
	at org.hibernate.loader.Loader.doQuery(Loader.java:874)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)
	at org.hibernate.loader.Loader.doList(Loader.java:2447)
	at org.hibernate.loader.Loader.doList(Loader.java:2433)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263)
	at org.hibernate.loader.Loader.list(Loader.java:2258)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470)
	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:1215)
	at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
	at z.ma.dao.M1DaoImpl.searchDatas(M1DaoImpl.java:14)
	at z.ma.junit.TestCase.testSearchDatas(TestCase.java:38)
	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)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.IllegalArgumentException: Can not set int field z.ma.eo.UserM1.updated_at to null value
	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
	at sun.reflect.UnsafeIntegerFieldAccessorImpl.set(UnsafeIntegerFieldAccessorImpl.java:62)
	at java.lang.reflect.Field.set(Field.java:657)
	at org.hibernate.property.DirectPropertyAccessor$DirectSetter.set(DirectPropertyAccessor.java:139)
	... 47 more
 原因是这样的:hiberante读int 整型数据出错 hiberante读数据库出错 去数据库看了一下 值确实为空.

问题解决方法:

<property name="state" type="java.lang.int"></property>

改为:

<property name="state" type="java.lang.Integer"></property>

类似的问题还有Double类型的情况.

http://blog.csdn.net/zzqzzq104/article/details/7236189

分享到:
评论

相关推荐

    tfs2010 assigned To改变邮件自动转发

    标题 "TFS2010 Assigned To 改变邮件自动转发" 涉及的是Team Foundation Server (TFS) 2010中的一项功能,该功能允许在工作项(Work Item)的“分配给”(Assigned To)字段发生变化时,系统会自动向新的指派人发送...

    Visual Studio打开Qt项目时“there's no Qt version assigned to this proj

    在使用Visual Studio开发Qt应用程序的过程中,可能会遇到这样一个棘手的问题:当你尝试打开一个Qt项目时,系统会弹出错误提示“there's no Qt version assigned to this project for platform win32”。这个问题表明...

    S7A驱动720版本

    - When the signal conditioning function "S&M" was used for a byte value, the driver wrote wrong values to the PLC. Build 223 : New Functions: - The number of supported NetLinks has been ...

    EHLib 6.3.171〖D7~XE5〗

    This property can be assigned by a maximum time, which will be used to calculate the widths of the columns when the user double click on the line that separates columns. If the time of calculation ...

    Kubernetes+in+Action-Manning(2018)

    After working at Red Hat for a few years, in late 2014 I was assigned to a newly- established team called Cloud Enablement. Our task was to bring the company’s range of middleware products to the ...

    数位板压力测试

    This specification was developed in response to a perceived need for a standardized programming inter-face to digitizing tablets, three dimensional position sensors, and other pointing devices by a ...

    2009 达内Unix学习笔记

    [] 匹配中括号里的内容[a-z][A-Z][0-9]。 ! 事件。 $ 取环境变量的值。 | 管道。把前一命令的输出作为后一命令的输入,把几个命令连接起来。 |经常跟tee连用,tee 把内容保存到文档并显示出来。 三、通用后...

    Poul Skott Stay Alive

    After his service with NASA, Lockhart was assigned to and graduated in 2004 from the Royal College of Defence Studies in London, United Kingdom. His last military assignment was with the headquarters ...

    servlet2.4doc

    Creates a cookie, a small amount of information sent by a servlet to a Web browser, saved by the browser, and later sent back to the server. Cookie(String, String) - Constructor for class javax....

    微软内部资料-SQL性能优化3

    Used to lock ranges between records in a table to prevent phantom insertions or deletions into a set of records. Ensures serializable transactions. RID A Row Identifier. Used to individually lock a ...

    haproxy-1.5.14.tar

    I want to address sincere congratulations to Charlie Smurthwaite of aTech Media for the really detailed traces he provided which made it possible to find the cause of this bug. Every user of 1.5-dev,...

    Delphi7.1 Update

    * Editing the value of an InternalCalc field on a nested TClientDataset causes the ChangeCount property of the parent dataset to increase (Quality Central 2027). * A TLargeIntField cannot be used as ...

    TscExcelExport 3.6 full source

    - Text property of field in stead of Value property is exported so OnGetText events can be used Version 2.91 - Improvements SetFormat (before exporting data) - Added support for fieldtype ...

    Big.Data.and.IT.Professionals.1514870622

    Big Data and IT Professionals: A Study of the Perceptions Held by IT Professionals in Relation to the Maturity, Value, and Practical Deployment of Big Data Solutions This work documents a research ...

    Kubernetes in Action-Manning Publications (2018)

    After working at Red Hat for a few years, in late 2014 I was assigned to a newlyestablished team called Cloud Enablement. Our task was to bring the company’s range of middleware products to the ...

    DELPHI7托盘图标控件,230(好用).zip

    when no popup menu was assigned to the icon. - ver. 1.0.2: Added a Handle property, and enabled handling of default menu items. (Partially) fixed a bug so the icon will update itself when a new ...

    acpi控制笔记本风扇转速

    produced when this parameter was a null string (""). Now, the original input filename is used as the AML output filename, with an ".aml" extension. Implemented a generic batch command mode for the ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Correct use of header files can make a huge difference to the readability, size and performance of your code. The following rules will guide you through the various pitfalls of using header files. ...

    Semi-Automatic 2D-to-3D Conversion Using disparity propagation

    Then, the initial disparity map is assigned to each key frame with the aid of various preset disparity models for each object. After the disparity assignment step, disparity maps for other frames of ...

    polycom宝利通视频会议软件3.9 2018

    Subject to the terms of this Laboratory and Developer License, POLYCOM grants you a limited, non-exclusive, non-transferable license to install and use, on a DEVICE, the number and type of SOFTWARE ...

Global site tag (gtag.js) - Google Analytics