Christoph Aigensberger (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5a72294...
) *commented* on HHH-16401 (
https://hibernate.atlassian.net/browse/HHH-16401?atlOrigin=eyJpIjoiNDg2MD...
)
Re: Hibernate does not escape Parameters correctly when using Oracle which causes
ORA-00904 (
https://hibernate.atlassian.net/browse/HHH-16401?atlOrigin=eyJpIjoiNDg2MD...
)
I was able to fix this in the oracle dialect.
The issue seems tobe that booleans are handled like literals by hibernate, and when
rendering the litteral the escaping by the converter is not applied.
@Override
public void visitQueryLiteral(QueryLiteral<?> queryLiteral) {
if (queryLiteral.getExpressionType().getJdbcMapping().getJavaTypeDescriptor()
instanceof BooleanJavaType
&&
queryLiteral.getExpressionType().getJdbcMapping().getJdbcType().getJdbcTypeCode() ==
Types.VARCHAR) {
super.visitQueryLiteral(new QueryLiteral<>("'" +
queryLiteral.getLiteralValue() + "'", queryLiteral.getExpressionType()));
} else {
super.visitQueryLiteral(queryLiteral);
}
}
I am now escaping it manually if the JavaType is of type Boolean but the JdbcType is a
conversion of Type VARCHAR
@Marco Belladelli maybe this might give you an idea what the issue is?
(
https://hibernate.atlassian.net/browse/HHH-16401#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16401#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:85acc52 )