Defines a ToOne-style association pointing to one of several entity types depending on a local discriminator,
as opposed to discriminated inheritance where the discriminator is kept as part of the entity hierarchy.
For example, if you consider an Order entity containing Payment information where Payment might be of type
CashPayment or CreditCardPayment the @Any approach would be to keep that discriminator and matching value on the
Order itself. Thought of another way, the "foreign-key" really is made up of the value and discriminator
(there is no physical foreign key here as databases do not support this):
@Entity
class Order {
...
@Any( metaColumn = @Column( name="payment_type" ) )
@AnyMetDef(
idType = "long"
metaValues = {
@MetaValue( value="C", targetEntity=CashPayment.class ),
@MetaValue( value="CC", targetEntity=CreditCardPayment.class ),
}
)
pubic Payment getPayment() { ... }
}
}