abstractpublisherfactory.java
来自「OR Mapping工具」· Java 代码 · 共 122 行
JAVA
122 行
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 Publisher * 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 AbstractPublisherFactory extends FactoryBase{/** this method returns the update string for the db */ protected String makeUpdateString () { return updateString; } protected static final String updateString = "update db_publisher set " + "version_number = ?," + "p_name = ?," + "p_address = ? where p_oid = ?";/** this method returns the insert string for the db */ protected String makeInsertString () { return insertString; } protected static final String insertString = "insert into db_publisher (" + "version_number," + "p_name," + "p_address) values (" + " ?," + " ?," + " ?)";/** this method sets the args for a prepared statement */ protected void setArguments (PreparedStatement stmt, Object obj, boolean update) throws SQLException { Publisher publisher = (Publisher)obj; int i = 1; if (!update && useStoredProcs ()) // set return val.. ((CallableStatement)stmt).registerOutParameter (i++, Types.INTEGER); stmt.setInt (i++, publisher.getVersion ()); stmt.setString (i++, publisher.getName ()); stmt.setString (i++, publisher.getAddress ()); if (update) stmt.setInt (i++, publisher.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_Publisher(?,?,?) }"; public static final String updateCallString = "{ call PROC_UPD_Publisher(?,?,?,?) }"; protected String makeUpdateCall () { return updateCallString; } protected boolean useStoredProcs () { return false; } // methods to store and delete public void delete (DatabaseSession dbSess, Publisher foo) throws SQLException { super.deleteObject (dbSess, foo); } public void store (DatabaseSession dbSess, Publisher 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{ Publisher foo = new Publisher (); 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{ Publisher foo = (Publisher)item; foo.setVersion (rs.getInt(version_number)); foo.setOid (rs.getInt (oid)); foo.setName (rs.getString (name)); foo.setAddress (rs.getString (address)); } public Publisher getByOid (DatabaseSession dbSess, int object_id) throws SQLException { return (Publisher)super.getObject (dbSess, this.oid, object_id); } public String getPrimaryColumn () { return "p_oid"; } public String getTableName () { return tableName; } // the variables to map Java to Sql protected final String tableName = "db_publisher"; public final String oid = "p_oid"; public final String name = "p_name"; public final String address = "p_address"; public final String version_number = "version_number"; protected AbstractPublisherFactory () { super (); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?