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
*/
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();
static {

View File

@ -182,6 +182,18 @@ public class ParameterParserTest {
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
public void testParseJPAPositionalParameter() {
ExtendedParameterRecognizer recognizer = createRecognizer();