org.hibernate.sql.Update Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate Show documentation
Show all versions of hibernate Show documentation
Relational Persistence for Java
//$Id: Update.java 7825 2005-08-10 20:23:55Z oneovthafew $
package org.hibernate.sql;
import java.util.Iterator;
import java.util.Map;
import org.hibernate.dialect.Dialect;
import org.hibernate.type.LiteralType;
import org.hibernate.util.StringHelper;
import org.apache.commons.collections.SequencedHashMap;
/**
* An SQL UPDATE statement
*
* @author Gavin King
*/
public class Update {
private String tableName;
private String[] primaryKeyColumnNames;
private String versionColumnName;
private String where;
private String assignments;
private String comment;
private Map columns = new SequencedHashMap();
private Map whereColumns = new SequencedHashMap();
private Dialect dialect;
public Update(Dialect dialect) {
this.dialect = dialect;
}
public String getTableName() {
return tableName;
}
public Update appendAssignmentFragment(String fragment) {
if ( assignments == null ) {
assignments = fragment;
}
else {
assignments += ", " + fragment;
}
return this;
}
public Update setTableName(String tableName) {
this.tableName = tableName;
return this;
}
public Update setPrimaryKeyColumnNames(String[] primaryKeyColumnNames) {
this.primaryKeyColumnNames = primaryKeyColumnNames;
return this;
}
public Update setVersionColumnName(String versionColumnName) {
this.versionColumnName = versionColumnName;
return this;
}
public Update setComment(String comment) {
this.comment = comment;
return this;
}
public Update addColumns(String[] columnNames) {
for ( int i=0; i