Java Reference
In-Depth Information
Bidder to BIDDERS . The following listing shows how to configure JPA using the joined-
tables strategy.
Listing 9.22. Joined-tables strategy
This listing shows the @DiscriminatorColumn and @DiscriminatorValue
annotations used in exactly the same way as the single-table strategy. The @In-
heritance annotation's strategy element is specified as JOINED . In addition, the one-
to-one relationships between parent and child tables are implemented through the
@PrimaryKeyJoinColumn annotations in both the Bidder and Seller
entities. In both cases, the name element specifies that BIDDER.USER_ID and
SELLER.USER_ID are foreign keys back to USER.USER_ID . Bidder and Seller
also use @Table to specify which table they map to (
The joined-tables strategy is probably the best mapping choice from a design perspective.
From a performance perspective, it's worse than the single-table strategy because it re-
quires the joining of multiple tables for polymorphic queries.
Search WWH ::

Custom Search