You can implement inheritance between @Embeddable
classes. You just have to annotate the parent class with @MappedSuperclass
too.
So, e.g.:
@Embeddable
@MappedSuperclass
public class Parent {
@Basic
private String parentProperty;
// ... getters/setters
}
@Embeddable
public class Child extends Parent {
@Basic
private String childProperty;
// ... getters/setters
}
This way Hibernate (tested with 5.x) will map both parentProperty
and childProperty
correctly in the Child
class.