HHH-17717 Add semicolon(`;`) to HQL_SEPARATORS

This commit is contained in:
qinxi 2024-02-07 15:36:37 +08:00 committed by Christian Beikov
parent 5309d9d63b
commit a97b7ba611
2 changed files with 13 additions and 1 deletions

View File

@ -22,7 +22,7 @@ import org.hibernate.query.sql.spi.ParameterRecognizer;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class ParameterParser { public class ParameterParser {
private static final String HQL_SEPARATORS = " \n\r\f\t,()=<>&|+-=/*'^![]#~\\"; private static final String HQL_SEPARATORS = " \n\r\f\t,;()=<>&|+-=/*'^![]#~\\";
private static final BitSet HQL_SEPARATORS_BITSET = new BitSet(); private static final BitSet HQL_SEPARATORS_BITSET = new BitSet();
static { static {

View File

@ -181,6 +181,18 @@ public class ParameterParserTest {
assertTrue(recognizer.getNamedParameters().contains("pxyz")); assertTrue(recognizer.getNamedParameters().contains("pxyz"));
assertEquals( 2, recognizer.getNamedParameters().size() ); assertEquals( 2, recognizer.getNamedParameters().size() );
} }
@Test
public void testParseNamedParameterEndWithSemicolon() {
ExtendedParameterRecognizer recognizer = createRecognizer();
NATIVE_QUERY_INTERPRETER.recognizeParameters("from Stock s where s.stockCode = :stockCode and s.xyz = :pxyz;", recognizer);
recognizer.complete();
recognizer.validate();
assertTrue(recognizer.getNamedParameters().contains("stockCode"));
assertTrue(recognizer.getNamedParameters().contains("pxyz"));
assertEquals( 2, recognizer.getNamedParameters().size() );
}
@Test @Test
public void testParseJPAPositionalParameter() { public void testParseJPAPositionalParameter() {