|
I have a simple Audited TestClass with two Embedded Attributes:
@Embedded
@AttributeOverrides({@AttributeOverride(name = "code", column = @Column(name = "THE_TEST"))})
private TestCode testCode = TestCode.TEST;
@Embedded
@AttributeOverrides({@AttributeOverride(name = "code", column = @Column(name = "THE_CODE")),
@AttributeOverride(name = "codeArt", column = @Column(name = "THE_CODEART"))})
private Code genericCode;
In the irst case, the column named "THE_TEST" is missing in the Audit Table. The Second attribute is ok.
The class TestCode where the Column is missing:
@Embeddable
public class TestCode extends AbstractCode {
public static final int _TEST = 1;
public static final TestCode TEST = new TestCode(_TEST);
public TestCode(int code) {
super(code);
}
protected TestCode() {
super(UNDEFINED);
}
@Override
@Transient
public String getCodeart() {
return "TestCode";
}
and it's superclass:
@MappedSuperclass
@Access(AccessType.FIELD)
public abstract class AbstractCode {
/** Initial Value */
protected static final int UNDEFINED = -1;
private int code = UNDEFINED;
protected AbstractCode() {
this(UNDEFINED);
}
/**
* Constructor with code
*/
public AbstractCode(int code) {
this.code = code;
}
public abstract String getCodeart();
public int getCode() {
return code;
}
}
this is the embedded that works fine:
@Embeddable
public class Code extends AbstractCode {
private String codeArt;
public Code(int code, String codeArt) {
super(code);
this.codeArt = codeArt;
}
protected Code() {
this (UNDEFINED, null);
}
@Override
public String getCodeart() {
return codeArt;
}
}
when I add @Audited to the class TestClass it works; but I think this should not be necessary.
|