org.hibernate.sql.Insert Maven / Gradle / Ivy
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.sql;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import org.hibernate.MappingException;
import org.hibernate.dialect.Dialect;
import org.hibernate.type.LiteralType;
/**
* An SQL INSERT statement
*
* @author Gavin King
*/
public class Insert {
private Dialect dialect;
private String tableName;
private String comment;
private Map columns = new LinkedHashMap();
public Insert(Dialect dialect) {
this.dialect = dialect;
}
protected Dialect getDialect() {
return dialect;
}
public Insert setComment(String comment) {
this.comment = comment;
return this;
}
public Insert addColumn(String columnName) {
return addColumn( columnName, "?" );
}
public Insert addColumns(String[] columnNames) {
for ( String columnName : columnNames ) {
addColumn( columnName );
}
return this;
}
public Insert addColumns(String[] columnNames, boolean[] insertable) {
for ( int i=0; i