- This topic has 2 replies, 2 voices, and was last updated 13 years, 5 months ago by
Greg Soulsby.
-
AuthorPosts
-
Greg SoulsbyMemberI have a field on a mySQL table of type datetime, not nullable
Scaffold as normal. To test, from the scaffolded edit form open an existing record and hit the “save” button.
Get exception
org.hibernate.PropertyValueException: not-null property references a null or transient value: myField NAME HERE
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:101)
………the line of code that has triggered the exception is
MyTablenameDAO.flush();In trying to track down what was going wrong I see myField is being returned from the form as NULL, where as the other fields are being returned with their values from the form.
When, on the Edit form, I change myField then the value returned is not null and the save works as expected.
My environment details include:
– Browser = Chrome and or Firefox (same result in both), latest versions
– MyEcplise for Spring 9.1 with all updates applied
– MySQL database, version as at about a month ago
– Ubuntu. Latest version, 64 bit, all updates applied
– Running Ubuntu under VirtualBox on Windows 7 Ultimate, all updatesHopefully you have come across this before – it looks like a bug somewhere in the stack?
jayperkinsMemberHi,
When you view the record is the date field populated? When you edit the record is the date field populated? If yes, does it look the same as if you select a value from the calendar popup – same format?
How are you determining the myField is null on the server. Obviously it is null because the database is complaining, but I wanted to know if you were debugging the code and at what point did you discover the myField value to be null.
Thanks,
Jay
Greg SoulsbyMemberThanks for the reply – answers inline below
[When you view the record is the date field populated? ]
Yes.[When you edit the record is the date field populated? ]
Yes – for testing I deleted the AM on the end, then it works[If yes, does it look the same as if you select a value from the calendar popup – same format? ]
The pop calendar is not showing – it is date time field. The JPS looks like its providing a pattern to validate against instead<input id=”xxxEmails_emailDate” name=”emailDate” type=”text” value=”<fmt:formatDate value=”${xxxEmails.emailDate.time}” pattern=”MM/dd/yyyy h:mm a”/>” style=”width:300px;”/>
[How are you determining the myField is null on the server. Obviously it is null because the database is complaining, but I wanted to know if you were debugging the code and at what point did you discover the myField value to be null. ]
In the Service object I output the fields to the console in the save function, seeing that the other fields were fine, but this one was null unless I did the edit described above -
AuthorPosts