mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 14:30:16 +00:00
HHH-7725 - Make handling multi-table bulk HQL operations more pluggable
(cherry picked from commit c94752d24322f1fe44a911038ca783f8ad9ab3c5)
This commit is contained in:
parent
e3239ae188
commit
e32d7f277c
@ -312,6 +312,23 @@ public String getCastTypeName(int code) {
|
||||
return getTypeName( code, Column.DEFAULT_LENGTH, Column.DEFAULT_PRECISION, Column.DEFAULT_SCALE );
|
||||
}
|
||||
|
||||
public String cast(String value, int jdbcTypeCode, int length, int precision, int scale) {
|
||||
if ( jdbcTypeCode == Types.CHAR ) {
|
||||
return "cast(" + value + " as char(" + length + "))";
|
||||
}
|
||||
else {
|
||||
return "cast(" + value + "as " + getTypeName( jdbcTypeCode, length, precision, scale ) + ")";
|
||||
}
|
||||
}
|
||||
|
||||
public String cast(String value, int jdbcTypeCode, int length) {
|
||||
return cast( value, jdbcTypeCode, length, Column.DEFAULT_PRECISION, Column.DEFAULT_SCALE );
|
||||
}
|
||||
|
||||
public String cast(String value, int jdbcTypeCode, int precision, int scale) {
|
||||
return cast( value, jdbcTypeCode, Column.DEFAULT_LENGTH, precision, scale );
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses register a type name for the given type code and maximum
|
||||
* column length. <tt>$l</tt> in the type name with be replaced by the
|
||||
|
@ -27,6 +27,7 @@
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -212,7 +213,10 @@ public DeleteHandler buildDeleteHandler(SessionFactoryImplementor factory, HqlSq
|
||||
return new TableBasedDeleteHandlerImpl( factory, walker ) {
|
||||
@Override
|
||||
protected String extraIdSelectValues() {
|
||||
return "cast(? as char)";
|
||||
final Dialect dialect = factory().getDialect();
|
||||
return dialect.requiresCastingOfParametersInSelectClause()
|
||||
? dialect.cast( "?", Types.CHAR, 36 )
|
||||
: "?";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user