I have the following classes defined in my system. When I attempt to persist them, the minValue and maxValue are not being persisted. and the minMaxRule table is not persisted either, the base table for the inheritance chain "Rule" does get updated with the appropriate info. I've run into this issue in a slightly different way before where a secondary table with all null values does not get generated, and it looks like even though there are comparevalues for min and max, since the id's are null to start hibernate thinks the secondaryTable will be null as well.
Any ideas?
Thanks
Robert Brown
Code:
@Entity
@SecondaryTable(name = "MinMaxRule", pkJoinColumns = @PrimaryKeyJoinColumn(name = "id", referencedColumnName = "id"))
@org.hibernate.annotations.Table(appliesTo="minmaxRule", optional=false)
@DiscriminatorValue("MIN_MAX")
public class MinMaxRule extends FieldRule {
private Comparevalue minValue;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(table = "MinMaxRule", name = "CompareMinimumValue_id", referencedColumnName = "id")
public Comparevalue getMinValue() {
return minValue;
}
public void setMinValue(Comparevalue minValue) {
this.minValue = minValue;
}
private Comparevalue maxValue;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(table = "MinMaxRule", name = "CompareMaximumValue_id", referencedColumnName = "id")
public Comparevalue getMaxValue() {
return maxValue;
}
public void setMaxValue(Comparevalue maxValue) {
this.maxValue = maxValue;
}
}
@Entity
//@Audited
public class Comparevalue {
private Integer id;
@javax.persistence.Column(name = "id")
@Id
@GeneratedValue()
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
private String value;
@javax.persistence.Column(name = "value")
@Basic
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
private Boolean constant;
@javax.persistence.Column(name = "static")
@Basic
public Boolean getConstant() {
return constant;
}
public void setConstant(Boolean constant) {
this.constant = constant;
}
}