1 package net.sourceforge.blogentis.om.map; 2 3 import org.apache.torque.Torque; 4 import org.apache.torque.TorqueException; 5 import org.apache.torque.map.DatabaseMap; 6 import org.apache.torque.map.MapBuilder; 7 import org.apache.torque.map.TableMap; 8 9 /*** 10 */ 11 public class SectionMapBuilder implements MapBuilder 12 { 13 /*** 14 * The name of this class 15 */ 16 public static final String CLASS_NAME = 17 "net.sourceforge.blogentis.om.map.SectionMapBuilder"; 18 19 20 /*** 21 * The database map. 22 */ 23 private DatabaseMap dbMap = null; 24 25 /*** 26 * Tells us if this DatabaseMapBuilder is built so that we 27 * don't have to re-build it every time. 28 * 29 * @return true if this DatabaseMapBuilder is built 30 */ 31 public boolean isBuilt() 32 { 33 return (dbMap != null); 34 } 35 36 /*** 37 * Gets the databasemap this map builder built. 38 * 39 * @return the databasemap 40 */ 41 public DatabaseMap getDatabaseMap() 42 { 43 return this.dbMap; 44 } 45 46 /*** 47 * The doBuild() method builds the DatabaseMap 48 * 49 * @throws TorqueException 50 */ 51 public void doBuild() throws TorqueException 52 { 53 dbMap = Torque.getDatabaseMap("blogentis"); 54 55 dbMap.addTable("Section"); 56 TableMap tMap = dbMap.getTable("Section"); 57 58 tMap.setPrimaryKeyMethod(TableMap.NATIVE); 59 60 tMap.setPrimaryKeyMethodInfo("Section_SEQ"); 61 62 tMap.addPrimaryKey("Section.SECTION_ID", new Integer(0)); 63 tMap.addForeignKey( 64 "Section.BLOG_ID", new Integer(0) , "Blog" , 65 "Blog_Id"); 66 tMap.addColumn("Section.NAME", new String()); 67 tMap.addColumn("Section.TITLE", new String()); 68 tMap.addColumn("Section.DESCRIPTION", new String()); 69 tMap.addColumn("Section.OBJECT_DATA", new Object()); 70 } 71 }