HHH-17776 - Fix whitespace padding issues for literals in select expressions on Derby and HSQLDB
Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
parent
ee76f005aa
commit
955b587eb7
|
@ -232,8 +232,13 @@ public class DerbySqlAstTranslator<T extends JdbcOperation> extends AbstractSqlA
|
|||
|
||||
@Override
|
||||
protected void renderSelectExpression(Expression expression) {
|
||||
if ( isInSubquery() && expression instanceof Literal ) {
|
||||
renderCasted( expression );
|
||||
}
|
||||
else {
|
||||
renderSelectExpressionWithCastedOrInlinedPlainParameters( expression );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderSelectTupleComparison(
|
||||
|
|
|
@ -258,8 +258,13 @@ public class HSQLSqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAs
|
|||
|
||||
@Override
|
||||
protected void renderSelectExpression(Expression expression) {
|
||||
if ( isInSubquery() && expression instanceof Literal ) {
|
||||
renderCasted( expression );
|
||||
}
|
||||
else {
|
||||
renderSelectExpressionWithCastedOrInlinedPlainParameters( expression );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderSelectTupleComparison(
|
||||
|
|
|
@ -2442,7 +2442,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
|||
.get( 1 ) == getCurrentQueryPart();
|
||||
}
|
||||
|
||||
private boolean isInSubquery() {
|
||||
protected boolean isInSubquery() {
|
||||
return statementStack.depth() > 1 && statementStack.getCurrent() instanceof SelectStatement
|
||||
&& !( (SelectStatement) statementStack.getCurrent() ).getQueryPart().isRoot();
|
||||
}
|
||||
|
|
|
@ -122,8 +122,8 @@ public class SubqueryTests {
|
|||
JpaDerivedRoot<Tuple> mainQueryRoot = mainQuery.from( unionAllSubQuery );
|
||||
|
||||
mainQuery.multiselect(
|
||||
builder.trim(mainQueryRoot.get("name")).alias("name"),
|
||||
builder.trim(mainQueryRoot.get("surName")).alias("surName")
|
||||
mainQueryRoot.get("name").alias("name"),
|
||||
mainQueryRoot.get("surName").alias("surName")
|
||||
);
|
||||
mainQuery.orderBy( builder.asc(mainQueryRoot.get("name")) );
|
||||
|
||||
|
|
Loading…
Reference in New Issue