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