Java Reference
In-Depth Information
superclass's table or to its subclasses' tables, or it can have its own table. However,
one tricky problem is mapping interfaces such as Coupon . As figure 5.1 shows, the
Coupon interface is implemented by the FreeShippingCoupon and Percentage-
DiscountCoupon classes.
We need to map the Coupon interface and its implementation classes to the COU-
PON table and map the many-to-one relationships Order - Coupon and Pending-
Order - Coupon to foreign keys in the PLACED_ORDER and PENDING_ORDER tables.
Unfortunately, JDO does not allow this to be done directly by mapping an interface
Domain Model
Database Schema
<<table>>
ORDER
Order
ORDER_ID <<pk>>
COUPON_ID <<fk>>
...
<<table>>
PENDING_ORDER
PendingOrder
PENDING_ORDER_ID <<pk>>
COUPON_ID <<fk>>
...
<<table>>
COUPON
<<interface>>
Coupon
COUPON_ID <<pk>>
TYPE
CODE <<unique>>
MINIMUM
PER_DISCOUNT
FreeShipping
Coupon
Percentage
DiscountCoupon
code
minimum
code
minimum
percentage
Figure 5.1
The object/relational mapping for the Coupon classes
 
 
 
Search WWH ::




Custom Search