facebook

Datetime fields have to be dirty = bug somewhere?

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #319907 Reply

    Greg Soulsby
    Member

    I 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 updates

    Hopefully you have come across this before – it looks like a bug somewhere in the stack?

    #319951 Reply

    jayperkins
    Member

    Hi,

    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

    #319959 Reply

    Greg Soulsby
    Member

    Thanks 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

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Datetime fields have to be dirty = bug somewhere?

You must be logged in to post in the forum log in