1 package org.paneris.jammyjoes.model; 2 3 import java.sql.ResultSet; 4 5 import org.melati.poem.Database; 6 import org.melati.poem.DefinitionSource; 7 import org.melati.poem.PoemException; 8 import org.paneris.jammyjoes.model.generated.SexTableBase; 9 10 /** 11 * Melati POEM generated, programmer modifiable stub 12 * for a <code>SexTable</code> object. 13 * <p> 14 * Description: 15 * Sex. 16 * </p> 17 * 18 * 19 * <table> 20 * <tr><th colspan='3'> 21 * Field summary for SQL table <code>Sex</code> 22 * </th></tr> 23 * <tr><th>Name</th><th>Type</th><th>Description</th></tr> 24 * <tr><td> id </td><td> Integer </td><td> </td></tr> 25 * <tr><td> sex </td><td> String </td><td> </td></tr> 26 * </table> 27 * 28 * @generator org.melati.poem.prepro.TableDef#generateTableMainJava 29 */ 30 public class SexTable extends SexTableBase { 31 32 Sex boy; 33 Sex girl; 34 35 public SexTable( 36 Database database, String name, 37 DefinitionSource definitionSource) throws PoemException { 38 super(database, name, definitionSource); 39 } 40 41 public synchronized void unifyWithDB(ResultSet colDescs) 42 throws PoemException { 43 super.unifyWithDB(colDescs); 44 boy = ensure("Boy"); 45 girl = ensure("Girl"); 46 } 47 48 public Sex ensure(String s) { 49 Sex sex = (Sex)getSexColumn().firstWhereEq(s); 50 if (sex != null) 51 return sex; 52 else { 53 sex = (Sex)newPersistent(); 54 sex.setSex(s); 55 return (Sex)getSexColumn().ensure(sex); 56 } 57 } 58 59 public Sex getBoy() { 60 return boy; 61 } 62 63 public Sex getGirl() { 64 return girl; 65 } 66 }