Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-1259

HHH-3584 - Generate SQL when Dynamic Update is true is including version field even when marked as updateable=false

    XMLWordPrintable

Details

    • Release Notes
    • Workaround Exists
    • Hide

      Workaround is to not use dynamicUpdate = true for Entities with versions generated in the database.

      Show
      Workaround is to not use dynamicUpdate = true for Entities with versions generated in the database.

    Description

      Hibernate JIRA ref : http://opensource.atlassian.com/projects/hibernate/browse/HHH-3584

      If an entity has the annotation:

      @Enitity(dynamicUpdate=true)

      And a field annotated as :

      @Version
      @Generated(GenerationTime.Always)
      @Column(updateable=false, insertable=false)

      The generated update sql will include the annotated field in the properties to be updated. This is incorrect and causes exceptions in certain cases. E.g updating a view where the resulting columns cross multiple tables.

      When the dynamicUpdate is set to true, the sql string is generated dynamically and initially the field marked as updateable=false is flagged as not to be included. The AbstractEntityPersiter.getPropertiesToUpdate method then checks if there is a versioning field, finds the above annotated column and now flags it to be included, neglecting to check whether this versioning field has also been marked as updateable=false, or whether @Generated(GenerationTime.ALWAYS) is there. (Although the last isn't really necessary as this annotation can't be there without the column being marked as not updateable and not insertable.)

      Attachments

        Issue Links

          Activity

            People

              rhn-support-dstephan David Stephan
              rhn-support-dstephan David Stephan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: