abstractpoetfactory.java
来自「OR Mapping工具」· Java 代码 · 共 163 行
JAVA
163 行
package org.ephman.junit.generated;import java.sql.*;import org.ephman.abra.utils.*;import org.ephman.abra.database.*;// Do not edit!! generated classes /** a factory to link the class Poet * to it's sql code and database table * @version Thu Jun 30 15:12:42 EDT 2005 * @author generated by Dave Knull */public abstract class AbstractPoetFactory extends FactoryBase{/** this method returns the update string for the db */ protected String makeUpdateString () { return updateString; } protected static final String updateString = "update db_poet set " + "version_number = ?," + "a_war_vet = ?," + "a_war_hero = ?," + "po_poem = ?," + "a_sal = ?," + "a_lname = ?," + "a_fname = ?," + "a_b_day = ? where a_oid = ?";/** this method returns the insert string for the db */ protected String makeInsertString () { return insertString; } protected static final String insertString = "insert into db_poet (" + "version_number," + "a_war_vet," + "a_war_hero," + "po_poem," + "a_sal," + "a_lname," + "a_fname," + "a_b_day) values (" + " ?," + " ?," + " ?," + " ?," + " ?," + " ?," + " ?," + " ?)";/** this method sets the args for a prepared statement */ protected void setArguments (PreparedStatement stmt, Object obj, boolean update) throws SQLException { Poet poet = (Poet)obj; int i = 1; if (!update && useStoredProcs ()) // set return val.. ((CallableStatement)stmt).registerOutParameter (i++, Types.INTEGER); stmt.setInt (i++, poet.getVersion ()); stmt.setString (i++, poet.getWarVeteran ()? "T" : "F"); stmt.setString (i++, getBooleanAsString(poet.getWarHero ())); stmt.setString (i++, poet.getSamplePoem ()); if (poet.getSalary() == null) stmt.setNull (i++, java.sql.Types.DECIMAL); else stmt.setObject (i++, poet.getSalary ()); stmt.setString (i++, poet.getLastName ()); stmt.setString (i++, poet.getFirstName ()); stmt.setTimestamp (i++, poet.getBirthday ()); if (update) stmt.setInt (i++, poet.getOid ()); }/** this method tells FactoryBase whether or not clobs exist */ protected boolean hasClobs () { return false; } protected String makeInsertCall () { return insertCallString; } public static final String insertCallString = "{? = call FUNC_INS_Poet(?,?,?,?,?,?,?,?) }"; public static final String updateCallString = "{ call PROC_UPD_Poet(?,?,?,?,?,?,?,?,?) }"; protected String makeUpdateCall () { return updateCallString; } protected boolean useStoredProcs () { return false; } // methods to store and delete public void delete (DatabaseSession dbSess, Poet foo) throws SQLException { super.deleteObject (dbSess, foo); } public void store (DatabaseSession dbSess, Poet foo) throws SQLException { super.storeObject (dbSess, foo); } /* a routine to build an object of this type from an sql ResultSet */ protected Identified makeFromResultSet (ResultSet rs) throws SQLException{ Poet foo = new Poet (); refreshFromResultSet (foo, rs); return foo; } /* a routine to overwrite an object of this type from an sql ResultSet */ protected void refreshFromResultSet (Identified item, ResultSet rs) throws SQLException{ Poet foo = (Poet)item; foo.setVersion (rs.getInt(version_number)); String bWarVeteran = rs.getString (warVeteran); if (bWarVeteran!= null) foo.setWarVeteran (bWarVeteran.equals ("T")); String t_WarHero = rs.getString (warHero); foo.setWarHero(getStringAsBoolean (t_WarHero)); foo.setSamplePoem (rs.getString (samplePoem)); foo.setSalary ((java.math.BigDecimal)rs.getObject (salary)); foo.setOid (rs.getInt (oid)); foo.setLastName (rs.getString (lastName)); foo.setFirstName (rs.getString (firstName)); foo.setBirthday (rs.getTimestamp (birthday)); } public Poet getByOid (DatabaseSession dbSess, int object_id) throws SQLException { return (Poet)super.getObject (dbSess, this.oid, object_id); } public String getPrimaryColumn () { return "a_oid"; } public String getTableName () { return tableName; } // the variables to map Java to Sql protected final String tableName = "db_poet"; public final String warVeteran = "a_war_vet"; public final String warHero = "a_war_hero"; public final String samplePoem = "po_poem"; public final String salary = "a_sal"; public final String oid = "a_oid"; public final String lastName = "a_lname"; public final String firstName = "a_fname"; public final String birthday = "a_b_day"; public final String version_number = "version_number"; protected AbstractPoetFactory () { super (); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?