In my application, Envers failed to create a AUD table for an entity that included a large string property (mapped to a TEXT column in MySQL). So the following class failed to generate a AUD table:
{code} package com.redhat.topicindex.entity;
// Generated Apr 19, 2011 6:51:53 AM by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.Table;
import org.hibernate.envers.Audited; import org.hibernate.validator.Length;
/** * Help generated by hbm2java */ @Entity @Audited @Table(name = "Help", catalog = "Topicize") public class Help implements java.io.Serializable { private static final long serialVersionUID = 8247134318338564478L; private Integer helpId; private String tableColId; private String helpText;
public Help() { }
public Help(String tableColId, String helpText) { this.tableColId = tableColId; this.helpText = helpText; }
@Id @GeneratedValue(strategy = IDENTITY) @Column(name = "HelpID", unique = true, nullable = false) public Integer getHelpId() { return this.helpId; }
public void setHelpId(Integer helpId) { this.helpId = helpId; }
@Column(name = "TableColID", length = 512) @Length(max = 512) public String getTableColId() { return this.tableColId; }
public void setTableColId(String tableColId) { this.tableColId = tableColId; }
@Column(name = "HelpText", length = 65535) @Length(max = 65535) public String getHelpText() { return this.helpText; }
public void setHelpText(String helpText) { this.helpText = helpText; }
} {code} Once the HelpText property was modified, the AUD table was created:
{code} package com.redhat.topicindex.entity;
// Generated Apr 19, 2011 6:51:53 AM by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.Table;
import org.hibernate.envers.Audited; import org.hibernate.validator.Length;
/** * Help generated by hbm2java */ @Entity @Audited @Table(name = "Help", catalog = "Topicize") public class Help implements java.io.Serializable { private static final long serialVersionUID = 8247134318338564478L; private Integer helpId; private String tableColId; private String helpText;
public Help() { }
public Help(String tableColId, String helpText) { this.tableColId = tableColId; this.helpText = helpText; }
@Id @GeneratedValue(strategy = IDENTITY) @Column(name = "HelpID", unique = true, nullable = false) public Integer getHelpId() { return this.helpId; }
public void setHelpId(Integer helpId) { this.helpId = helpId; }
@Column(name = "TableColID", length = 512) @Length(max = 512) public String getTableColId() { return this.tableColId; }
public void setTableColId(String tableColId) { this.tableColId = tableColId; }
@Column(name = "HelpText", length = 2048) @Length(max = 2048) public String getHelpText() { return this.helpText; }
public void setHelpText(String helpText) { this.helpText = helpText; }
} {code} |
|