这是一份人力资源管理系统的源码

源代码在线查看: delete.java

软件大小: 20671 K
上传用户: zhangyan
关键词: 人力资源管理系统 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				//$Id: Delete.java,v 1.2.2.1 2003/11/27 15:28:38 oneovthafew Exp $
				package net.sf.hibernate.sql;
				
				import net.sf.hibernate.util.StringHelper;
				
				/**
				 * An SQL DELETE statement
				 * 
				 * @author Gavin King
				 */
				public class Delete {
					
					private String tableName;
					private String[] primaryKeyColumnNames;
					private String versionColumnName;
					private String where;
					
					public Delete setTableName(String tableName) {
						this.tableName = tableName;
						return this;
					}
					
					public String toStatementString() {
						StringBuffer buf = new StringBuffer( tableName.length() + 10 );
						buf.append("delete from ")
							.append(tableName)
							.append(" where ")
							.append( StringHelper.join("=? and ", primaryKeyColumnNames) )
							.append("=?");
						if (where!=null) {
							buf.append(" and ")
								.append(where);
						}
						if (versionColumnName!=null) {
							buf.append(" and ")
								.append(versionColumnName)
								.append("=?");
						}
						return buf.toString(); 
					}
					
					public Delete setWhere(String where) {
						this.where=where;
						return this;
					}
					
					public Delete setPrimaryKeyColumnNames(String[] primaryKeyColumnNames) {
						this.primaryKeyColumnNames = primaryKeyColumnNames;
						return this;
					}
				
					public Delete setVersionColumnName(String versionColumnName) {
						this.versionColumnName = versionColumnName;
						return this;
					}
				
				}
							

相关资源