Java Reference
In-Depth Information
public class FoodToGoHibernateMappingTests extends
HibernateMappingTests {
public void testPendingOrderMapping() throws SQLException,
HibernateException {
B
Verifies table
mapping
assertClassMapping(PendingOrder.class,
"PENDING_ORDER");
C
Verifies simple
field mapping
assertIdField("id", "PENDING_ORDER_ID");
assertField("state", "STATE");
assertManyToOneField("restaurant",
"RESTAURANT_ID");
D
Verifies
association
E
Verifies delivery
address
assertComponentField("deliveryAddress");
ComponentFieldMapping deliveryAddress =
getComponentFieldMapping("deliveryAddress");
deliveryAddress.assertAllFieldsMapped();
F
Verifies line
items
assertCompositeListField("lineItems");
CompositeListFieldMapping lineItems =
getCompositeListFieldMapping("lineItems");
lineItems.assertTable("PENDING_ORDER_LINE_ITEM");
lineItems.assertForeignKey("PENDING_ORDER_ID");
lineItems.assertIndexColumn("LINE_ITEM_INDEX");
lineItems.assertField("quantity", "QUANTITY");
lineItems.assertManyToOneField("menuItem", "MENU_ITEM_ID");
lineItems.assertAllFieldsMapped();
// PaymentInformation
// Coupon
// …
assertAllFieldsMapped();
}
Let's look at the details:
G
Verifies that all
fields are mapped
B
testPendingOrderMapping()
verifies that the
PendingOrder
class is mapped to the
correct table.
C
D
This method verifies
PendingOrder
's simple value fields are mapped correctly.
testPendingOrderMapping()
verifies the mapping for the
PendingOrder
-
Restaurant
association.
This method verifies the mapping for delivery address, which is an embedded
value object.
E
Search WWH ::
Custom Search