The DBBean Framework |
Introduction Main Objects Batch Sql Files Bean Generation Basic Operations Advanced Operations API - JavaDocs Download Alpha Developers / Contact |
Automatically Generating DBBeans
The com.sidman.db.util.TableToBean class is a standalone program which will automatically generate the DBBean java files for an existing database. See the JavaDocs docs for the paramaters to pass to the main method of this class. An example of a DBBean generated by this utility for the PERSON table is: import com.sidman.db.*; import java.util.Hashtable; /** * Automatically generated bean class */ public class PERSONBean extends SingleTablePkBean { public static final String TABLE = "PERSON"; public static final String PERSON_ID = "PERSON.PERSON_ID"; public static final String FIRST_NAME = "PERSON.FIRST_NAME"; public static final String LAST_NAME = "PERSON.LAST_NAME"; public static final String AGE = "PERSON.AGE"; public static final Hashtable _schema; static { Hashtable temp = new Hashtable(); temp.put(PERSON_ID,java.lang.Integer.class); temp.put(FIRST_NAME,java.lang.String.class); temp.put(LAST_NAME,java.lang.String.class); temp.put(AGE,java.lang.Integer.class); _schema = temp; } /** * @return The schema for this table */ public Hashtable getSchema() { return _schema; } /** * @return The name of the Table */ public String getTableName() { return TABLE; } /** * @return The name of the Primary Key column */ public String getPkName() { return PERSON_ID; } } |