Methods Summary |
---|
public org.hibernate.sql.Insert | addColumn(java.lang.String columnName)
return addColumn(columnName, "?");
|
public org.hibernate.sql.Insert | addColumn(java.lang.String columnName, java.lang.String value)
columns.put(columnName, value);
return this;
|
public org.hibernate.sql.Insert | addColumn(java.lang.String columnName, java.lang.Object value, org.hibernate.type.LiteralType type)
return addColumn( columnName, type.objectToSQLString(value, dialect) );
|
public org.hibernate.sql.Insert | addColumns(java.lang.String[] columnNames)
for ( int i=0; i<columnNames.length; i++ ) {
addColumn( columnNames[i] );
}
return this;
|
public org.hibernate.sql.Insert | addColumns(java.lang.String[] columnNames, boolean[] insertable)
for ( int i=0; i<columnNames.length; i++ ) {
if ( insertable[i] ) {
addColumn( columnNames[i] );
}
}
return this;
|
public org.hibernate.sql.Insert | addIdentityColumn(java.lang.String columnName)
String value = dialect.getIdentityInsertString();
if ( value != null ) {
addColumn( columnName, value );
}
return this;
|
protected org.hibernate.dialect.Dialect | getDialect()
return dialect;
|
public org.hibernate.sql.Insert | setComment(java.lang.String comment)
this.comment = comment;
return this;
|
public org.hibernate.sql.Insert | setTableName(java.lang.String tableName)
this.tableName = tableName;
return this;
|
public java.lang.String | toStatementString()
StringBuffer buf = new StringBuffer( columns.size()*15 + tableName.length() + 10 );
if ( comment != null ) {
buf.append( "/* " ).append( comment ).append( " */ " );
}
buf.append("insert into ")
.append(tableName);
if ( columns.size()==0 ) {
buf.append(' ").append( dialect.getNoColumnsInsertString() );
}
else {
buf.append(" (");
Iterator iter = columns.keySet().iterator();
while ( iter.hasNext() ) {
buf.append( iter.next() );
if ( iter.hasNext() ) {
buf.append( ", " );
}
}
buf.append(") values (");
iter = columns.values().iterator();
while ( iter.hasNext() ) {
buf.append( iter.next() );
if ( iter.hasNext() ) {
buf.append( ", " );
}
}
buf.append(')");
}
return buf.toString();
|