Ok, this question is best explained in code. So will try to present the most succinct example I can.
Timestamped.java
@Embeddable
public class Timestamped<E> {
private E value;
private Date timestamp;
...
}
Foo.java
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="TYPE")
public class Foo {
@Embedded
@AttributeOverides({
@AttributeOverride(name="timestamp", column=@Column("VALUE_TS")),
@AttributeOverride(name="value", column=@Column("VALUE"))
})
private TimestampedValue<E> value;
...
}
Bar.java
@Entity
@DiscriminatorValue("BAR")
public class Bar extends Foo<Double> { }
What I need is for Bar to use the appropriate type converter for value.value and a different converter for each subclass of Foo. Ideally I would just like to augment this code, but I would be OK making Foo abstract and moving the value field to each of the subclasses with additional annotations.