Removes PlainSelect casting in JSqlParserQueryEnhancer.

Closes: #3869
Original pull request: #3870

Signed-off-by: Diego Pedregal <diego.p.hidalgo@gmail.com>
This commit is contained in:
Diego Pedregal
2025-05-05 11:13:59 +02:00
committed by Mark Paluch
parent d463f5fd45
commit cfeb314978
2 changed files with 11 additions and 1 deletions

View File

@@ -64,6 +64,7 @@ import org.springframework.util.StringUtils;
* @author Geoffrey Deremetz
* @author Yanming Zhou
* @author Christoph Strobl
* @author Diego Pedregal
* @since 2.7.0
*/
public class JSqlParserQueryEnhancer implements QueryEnhancer {
@@ -237,7 +238,7 @@ public class JSqlParserQueryEnhancer implements QueryEnhancer {
}
StringJoiner joiner = new StringJoiner(", ");
for (SelectItem<?> selectItem : ((PlainSelect) selectBody).getSelectItems()) {
for (SelectItem<?> selectItem : selectBody.getPlainSelect().getSelectItems()) {
joiner.add(selectItem.toString());
}
return joiner.toString().trim();

View File

@@ -257,4 +257,13 @@ public class JSqlParserQueryEnhancerUnitTests extends QueryEnhancerTckTests {
null));
}
@Test // GH-3869
void shouldWorkWithoutFromClause() {
String query = "SELECT is_contained_in(:innerId, :outerId)";
StringQuery stringQuery = new StringQuery(query, true);
assertThat(stringQuery.getQueryString()).isEqualTo(query);
}
}