Persistable interface.

COMPONENT JAVA
Applying Design Patterns to JDBC: Building a Lightweight Object-Relational Mapping Framework
Frank Sauer
Listing 1. Persistable interface.


package com.trcinc.infrastructureservices.jdbc;
import java.util.*;

/**
 * Every Persistable must be able to provide a Map
 * containing the properties of the object and a List
 * of property names that make up the Primary key.
 * Poor man's ORM... Used by DefaultSqlOperation,
 *
 * @author  Frank Sauer
 * @version 1.0
 * @see DefaultSqlOperation
 */
public interface Persistable {
    /**
     * Get a list of properties representing the persistable
     * domain object. The keys are DB column names to
     * which the values will be written.
     */
    public Map getProperties();
    
    /**
     * Set the properties of this persistable domain object
     * from the values contained in properties.
     */
    public void setProperties(Map properties);
}