3 Replies Latest reply on Dec 22, 2008 6:36 PM by talios

    Revision Type is null (trunk)

    talios

      I just noticed that my _revision_type column is now getting a null record stored when I make changes to a record.

      Initially I noticed that envers has changed the default field names so I'm setting org.hibernate.envers.revisionTypeFieldName and org.hibernate.envers.revisionFieldName and see the following:

      _revision | _revision_type | party_id | first_name | middle_name
      105038 | 0 | 2000365 | Suryanarayana | | Rao
      107950 | | 2000365 | Suryanarayana | | Raos
      107951 | | 2000365 | Suryanarayana | | Rao

      The initial revision 105038 was from an earlier version of envers/hibernate. Shouldn't I be seeing a revision type of 1 for edits?

        • 1. Re: Revision Type is null (trunk)
          adamw

          Hello,

          yes, you should of course see 1s there. I create a JIRA bug for that and I'll look at it as soon as possible.
          (http://opensource.atlassian.com/projects/hibernate/browse/HHH-3671)

          --
          Thanks,
          Adam

          • 2. Re: Revision Type is null (trunk)
            adamw

            Hello,

            I tried running Envers with all settings as specified in the migration manual chepter (except for one small change: auditTableSuffix, not versionsTableSuffix) and all seems to work. Are you able to reproduce the problem?

            My settings:

            <property name="org.hibernate.envers.revisionTypeFieldName">_rev_type</property>
             <property name="org.hibernate.envers.auditTableSuffix">_versions</property>
             <property name="org.hibernate.envers.revisionFieldName">_revision</property>
            

            + a custom revision entity:
            @Entity
            @RevisionEntity
            @Table(name="_revisions_info")
            public class TestRevisionEntity {
             @Id
             @GeneratedValue
             @RevisionNumber
             @Column(name="revision_id")
             private int id;
            
             @RevisionTimestamp
             @Column(name="revision_timestamp")
             private long timestamp;
            
             private String username;
            
             public int getId() {
             return id;
             }
            
             public void setId(int id) {
             this.id = id;
             }
            
             public long getTimestamp() {
             return timestamp;
             }
            
             public void setTimestamp(long timestamp) {
             this.timestamp = timestamp;
             }
            
             public String getUsername() {
             return username;
             }
            
             public void setUsername(String username) {
             this.username = username;
             }
            }
            


            --
            Adam


            • 3. Re: Revision Type is null (trunk)
              talios

              Using the latest trunk I'm still seeing my _revision_type columns being null.

              Looking at my postgres logs I see the following SQL executed:

              2008-12-22 14:31:17 NZDT LOG: duration: 0.201 ms parse <unnamed>: insert into smx3.postal_address_versions (address1, address2, attn_name, city, directions, postal_code, to_name, contact_mech_id, _revision) values ($1, $2, $3, $4, $5, $6, $7, $8, $9)
              2008-12-22 14:31:17 NZDT LOG: duration: 0.073 ms bind <unnamed>: insert into smx3.postal_address_versions (address1, address2, attn_name, city, directions, postal_code, to_name, contact_mech_id, _revision) values ($1, $2, $3, $4, $5, $6, $7, $8, $9)
              2008-12-22 14:31:17 NZDT DETAIL: parameters: $1 = 'CMC House', $2 = 'C-18 Bandra Kurla Complex', $3 = NULL, $4 = 'Mumbai', $5 = NULL, $6 = '400051', $7 = NULL, $8 = '2000220', $9 = '108400'
              


              So I see the _revision field being inserted, but not _revision_type.