Beispiel #1
0
 // populate (could optionally have reflective populate)
 public synchronized void populate(SQLRow row) {
   row.setValue("source", food.getSource().getName());
   row.setValue("food", food.getSourceID());
   if (date != 0) {
     row.setValue("time", new Timestamp(date));
   }
   row.setValue("grams", new Double(grams));
   if (measure != Measure.GRAM) {
     row.setValue("measure", measure.getDescription());
   }
 }
Beispiel #2
0
 // generate the table mapping, could use xml def
 public synchronized SQLRow toSQLRow() {
   SQLRow row = new SQLRow("serving");
   row.addColumn("source", Types.VARCHAR);
   row.addColumn("food", Types.VARCHAR);
   row.addColumn("time", Types.TIMESTAMP);
   row.addColumn("grams", Types.DOUBLE);
   row.addColumn("measure", Types.VARCHAR);
   return row;
 }