@Target(value={METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface Any
@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() { ... }
}
}
AnyMetaDef| Modifier and Type | Required Element and Description |
|---|---|
javax.persistence.Column |
metaColumn
Identifies the discriminator column.
|
| Modifier and Type | Optional Element and Description |
|---|---|
javax.persistence.FetchType |
fetch
Defines whether the value of the field or property should be lazily loaded or must be
eagerly fetched.
|
java.lang.String |
metaDef
Metadata definition used.
|
boolean |
optional
Whether the association is optional.
|
public abstract javax.persistence.Column metaColumn
public abstract java.lang.String metaDef
public abstract javax.persistence.FetchType fetch
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.