I have implemented a solution similar to: How to use Hibernate @Any-related annotations?, and it's getting out of hand - I have too many mappings which have similar mapping "scheme":
@Any(metaColumn = @Column(name = "something_type"), fetch = FetchType.LAZY)
@AnyMetaDef(idType = "long", metaType = "string", metaValues = {
@MetaValue(value = "A", targetEntity = AImpl.class),
@MetaValue(value = "B", targetEntity = BImpl.class),
@MetaValue(value = "C", targetEntity = CImpl.class),
@MetaValue(value = "D", targetEntity = DImpl.class),
@MetaValue(value = "E", targetEntity = EImpl.class),
etc.. })
public BaseSomething getRelatedSometing() {
return relatedSometing;
}
I've tried to keep a value (e.g. "A") that can be computed to a target (e.g. "AImpl"). Is there a way to avoid listing all the implementation by hand, but still keep hibernate happy?