转载自:小屁孩
Q Q:6241899
Q Q群:28187997,76434335,72217599
网址:http://xiaopihai.iteye.com/blog/531208
>>> 版权所有,转载请注明出处!<<<
Exception:
org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.seven.domain.Book.printTime
原因:数据库里printTime字段为NULL
Java代码
<!--Hibernate映射文件中的字段-->
<property name="printTime" type="long"><column name="print_time"/></property>
Java代码
<!--Hibernate映射文件中的字段-->
<property name="printTime" type="long"><column name="print_time"/></property>
<!--Hibernate映射文件中的字段-->
<property name="printTime" type="long"><column name="print_time"/></property>
其中的类型为hibernate类型,在生成的Book类中,printTime字段为long类型,为基本类型,不能为NULL.
解决方法:
第一种:数据库字段不设置为空;
第二种:手动修改映射文件,printTime使用Java类型Long,即type="java.lang.Long",Book类中的字段也要改为Long。同理,int为Integer.
第三种:在反向工程时使用Java类型,而不是hibernate类型。
分享到:
相关推荐
标题 "TFS2010 Assigned To 改变邮件自动转发" 涉及的是Team Foundation Server (TFS) 2010中的一项功能,该功能允许在工作项(Work Item)的“分配给”(Assigned To)字段发生变化时,系统会自动向新的指派人发送...
在使用Visual Studio开发Qt应用程序的过程中,可能会遇到这样一个棘手的问题:当你尝试打开一个Qt项目时,系统会弹出错误提示“there's no Qt version assigned to this project for platform win32”。这个问题表明...
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 ...
- 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 ...
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 ...
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 ...
[] 匹配中括号里的内容[a-z][A-Z][0-9]。 ! 事件。 $ 取环境变量的值。 | 管道。把前一命令的输出作为后一命令的输入,把几个命令连接起来。 |经常跟tee连用,tee 把内容保存到文档并显示出来。 三、通用后...
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,...
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 ...
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 ...
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....
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 ...
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 ...
- 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 ...
* 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 ...
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 ...
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 ...
Friends Exceptions Run-Time Type Information (RTTI) Casting Streams Preincrement and Predecrement Use of const Integer Types 64-bit Portability Preprocessor Macros 0 and NULL sizeof Boost C++0x ...
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 ...