Associating an Address with a Customer.
- By Frank Sauer
- April 24, 2001
COMPONENT JAVA
Applying Design Patterns to JDBC: Building a Lightweight Object-Relational Mapping Framework
Frank Sauer
Listing 4. Associating an Address with a Customer.
class InsertDefaultAddress
extends DefaultSQLOperation
implements SQLConstants {
private Customer c = null;
InsertDefaultAddress (Customer c) {
super(insertDefaultAddress,
insertDefaultAddressColumns);
this.c = c;
// map columns from Address object
setPersistable(c.getDefaultAddress());
}
protected Map getProperties() {
Map m = super.getProperties();
m.put(ADDRESS_LASTUPDATED,
new java.util.Date());
// make the link to the customer
m.put(ADDRESS_CUSTOMER,
new BigDecimal(c.getId()));
return m;
}
}