Annotation Interface NaturalIdClass
Models a non-aggregated composite natural-id for the purpose of loading. The non-aggregated form uses multiple @NaturalId as opposed to the aggregated form which uses a single @NaturalId combined with @Embedded. Functions in a similar fashion as @IdClass for non-aggregated composite identifiers.
@Entity
@NaturalIdClass(OrderNaturalId.class)
class Order {
@Id
Integer id;
@NaturalId @ManyToOne
Customer customer;
@NaturalId
Integer orderNumber;
...
}
class OrderNaturalId {
Customer customer;
Integer orderNumber;
...
}
- Since:
- 7.3
- See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
value
Class<?> valueThe class to use for loading the associated entity by natural-id.
-