Query methods with isTrue/isFalse predicates do not work with Oracle #1090
Labels
status: waiting-for-feedback
We need additional information before we can continue
status: waiting-for-triage
An issue we've not yet triaged
Query methods in repositories such as
findByAvailableIsTrue()
are converted to SQL statements with where parts like("SOME_TABLE"."AVAILABLE" = TRUE)
. This is fine for many databases, but Oracle has no boolean type and people typically use the typeNUMBER(1)
instead. In such a case, the predicate should correctly translate to("SOME_TABLE"."AVAILABLE" = 1)
.The reason for this erroneous translation is located in
org.springframework.data.relational.core.sql.render.ExpressionVisitor
, which in our case calls thetoString()
method of theorg.springframework.data.relational.core.sql.BooleanLiteral
to compute the value of the expression (TRUE
), despite the fact that the documentation of thetoString()
method of theorg.springframework.data.relational.core.sql.Segment
interface (whichBooleanLiteral
implements) explicitly states thatA possible solution would be to extend
org.springframework.data.relational.core.dialect.Dialect
with amethod that would then be implemented in
OracleDialect
.The text was updated successfully, but these errors were encountered: