Methods Summary |
---|
public org.hibernate.sql.Delete | addWhereFragment(java.lang.String fragment)
if ( where == null ) {
where = fragment;
}
else {
where += ( " and " + fragment );
}
return this;
|
public org.hibernate.sql.Delete | setComment(java.lang.String comment)
this.comment = comment;
return this;
|
public org.hibernate.sql.Delete | setPrimaryKeyColumnNames(java.lang.String[] primaryKeyColumnNames)
this.primaryKeyColumnNames = primaryKeyColumnNames;
return this;
|
public org.hibernate.sql.Delete | setTableName(java.lang.String tableName)
this.tableName = tableName;
return this;
|
public org.hibernate.sql.Delete | setVersionColumnName(java.lang.String versionColumnName)
this.versionColumnName = versionColumnName;
return this;
|
public org.hibernate.sql.Delete | setWhere(java.lang.String where)
this.where=where;
return this;
|
public java.lang.String | toStatementString()
StringBuffer buf = new StringBuffer( tableName.length() + 10 );
if ( comment!=null ) {
buf.append( "/* " ).append(comment).append( " */ " );
}
buf.append( "delete from " ).append(tableName);
if ( where != null || primaryKeyColumnNames != null || versionColumnName != null ) {
buf.append( " where " );
}
boolean conditionsAppended = false;
if ( primaryKeyColumnNames != null ) {
buf.append( StringHelper.join( "=? and ", primaryKeyColumnNames ) ).append( "=?" );
conditionsAppended = true;
}
if ( where!=null ) {
if ( conditionsAppended ) {
buf.append( " and " );
}
buf.append( where );
conditionsAppended = true;
}
if ( versionColumnName!=null ) {
if ( conditionsAppended ) {
buf.append( " and " );
}
buf.append( versionColumnName ).append( "=?" );
}
return buf.toString();
|