HHH-5932 Fix filtering request with string literal starting with ':'.

This commit is contained in:
Etienne Miret 2014-08-30 03:00:02 +02:00 committed by Steve Ebersole
parent f52b841c5c
commit e2b58d1d20
2 changed files with 6 additions and 5 deletions

View File

@ -36,6 +36,11 @@ import org.jboss.logging.Logger;
public final class QueryParameters {
private static final Logger LOG = CoreLogging.logger( QueryParameters.class );
/**
* Symbols used to split SQL string into tokens in {@link #processFilters(String, Map, SessionFactoryImplementor)}.
*/
private static final String SYMBOLS = ParserHelper.HQL_SEPARATORS.replace( "'", "" );
private Type[] positionalParameterTypes;
private Object[] positionalParameterValues;
private Map<String,TypedValue> namedParameters;
@ -473,10 +478,7 @@ public final class QueryParameters {
processedSQL = sql;
}
else {
final Dialect dialect = factory.getDialect();
final String symbols = ParserHelper.HQL_SEPARATORS + dialect.openQuote() + dialect.closeQuote();
final StringTokenizer tokens = new StringTokenizer( sql, symbols, true );
final StringTokenizer tokens = new StringTokenizer( sql, SYMBOLS, true );
StringBuilder result = new StringBuilder();
List parameters = new ArrayList();
List parameterTypes = new ArrayList();

View File

@ -462,7 +462,6 @@ public class DynamicFilterTest extends BaseNonConfigCoreFunctionalTestCase {
@Test
@TestForIssue( jiraKey = "HHH-5932" )
@FailureExpected( jiraKey = "HHH-5932" )
public void testHqlQueryWithColons() {
final Session session = openSession();
session.enableFilter( "region" ).setParameter( "region", "PACA" );