Grails
  1. Grails
  2. GRAILS-8988

GORM autoTimestamp not working due to org.hibernate.PropertyValueException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.2, 2.0.3
    • Fix Version/s: 2.0.4
    • Component/s: Persistence
    • Labels:
    • Environment:
      Windows 7 x64, Java 1.7.0_02 SDK, integrated tomcat

      Description

      After creating new project with single domain class, adding dateCreated property, and then scaffolding, cannot save new instances due to the following exception:

      2012-04-02 18:03:39,949 [http-bio-8080-exec-6] ERROR StackTrace - Full Stack Trace:
      org.hibernate.PropertyValueException: not-null property references a null or transient value: testapp.AutoTimestampTest.dateCreated
      at org.hibernate.engine.Nullability.checkNullability(Nullability.java:100)
      at org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor.performSaveOrReplicate(ClosureEventTriggeringInterceptor.java:242)
      ...

      Have tried explicitly setting autoTimestamp static mapping to true with no luck.

        Issue Links

          Activity

          Hide
          Ritesh M Nayak added a comment -

          Only certain builds fail for a certain version. This happened to us for both 2.0.1 and 2.0.3. Any way to resolve this without actually setting the dateCreated and lastUpdated values explicitly?

          Show
          Ritesh M Nayak added a comment - Only certain builds fail for a certain version. This happened to us for both 2.0.1 and 2.0.3. Any way to resolve this without actually setting the dateCreated and lastUpdated values explicitly?
          Hide
          Lari Hotari added a comment -

          Before the fix is released, the only workaround seems to be to use "Date dateCreated = new Date()" and "Date lastUpdated = new Date()" in the class definition.

          Show
          Lari Hotari added a comment - Before the fix is released, the only workaround seems to be to use "Date dateCreated = new Date()" and "Date lastUpdated = new Date()" in the class definition.
          Hide
          Keith Ganger added a comment -

          I am still experiencing this issue with Grails 2.1.0 against oracle 10G.
          The problem doesn't seem to occur against MySql

          I do not have any constraints defined for the dateCreated field

          caused by: java.sql.SQLException: ORA-01407: cannot update ("ATLO10_FLAG_DB"."DISPOSITION_ENTRY"."DATE_CREATED") to NULL

          Show
          Keith Ganger added a comment - I am still experiencing this issue with Grails 2.1.0 against oracle 10G. The problem doesn't seem to occur against MySql I do not have any constraints defined for the dateCreated field caused by: java.sql.SQLException: ORA-01407: cannot update ("ATLO10_FLAG_DB"."DISPOSITION_ENTRY"."DATE_CREATED") to NULL
          Hide
          Angelo Alfano added a comment -

          I have this issue with grails 2.1.1, Postgres on domain with custom multi column hibernate type

          Show
          Angelo Alfano added a comment - I have this issue with grails 2.1.1, Postgres on domain with custom multi column hibernate type
          Hide
          Martin Sewering added a comment -

          see GRAILS-9805, bug-fix is not (yet) included in Grails 2.1 and 2.2 .

          Show
          Martin Sewering added a comment - see GRAILS-9805 , bug-fix is not (yet) included in Grails 2.1 and 2.2 .

            People

            • Assignee:
              Lari Hotari
              Reporter:
              Keith Gaputis
            • Votes:
              3 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development