HHH-11028 - {h-schema} is not replaced in SQLDelete, SQLInsert and SQLUpdate

Skip substitute brackets for stored procedures
This commit is contained in:
Vlad Mihalcea 2017-11-21 14:03:59 +02:00
parent 44a31550c4
commit 9b062e4a6b
1 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.hibernate.QueryException;
import org.hibernate.engine.query.spi.ParameterParser;
@ -24,6 +25,7 @@ import org.hibernate.persister.entity.SQLLoadable;
* @author Paul Benedict
*/
public class SQLQueryParser {
private static final Pattern PREPARED_STATEMENT_PATTERN = Pattern.compile( "^\\{.*?\\}$" );
private static final String HIBERNATE_PLACEHOLDER_PREFIX = "h-";
private static final String DOMAIN_PLACEHOLDER = "h-domain";
private static final String CATALOG_PLACEHOLDER = "h-catalog";
@ -74,6 +76,10 @@ public class SQLQueryParser {
// don't get'em'all we throw an exception! Way better than trial and error ;)
protected String substituteBrackets(String sqlQuery) throws QueryException {
if ( PREPARED_STATEMENT_PATTERN.matcher( sqlQuery ).matches() ) {
return sqlQuery;
}
StringBuilder result = new StringBuilder( sqlQuery.length() + 20 );
int left, right;