I have this query:
List<AspectEs> findAllByProcessedIsTrueAndNatalIsOrSolarIs
(Boolean processed, Integer natal, Integer solar);
But I have this error:
Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.List com.mysticriver.repository.AspectEsRepository.findAllByProcessedIsTrueAndNatalIsOrSolarIs(java.lang.Boolean,java.lang.Integer,java.lang.Integer); Cannot compare left expression of type 'java.lang.Integer' with right expression of type 'java.lang.Boolean'
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:106)
column definition:
@Column(columnDefinition = "bit default 0 ")
private Boolean processed;
Your method signature:
List<AspectEs> findAllByProcessedIsTrueAndNatalIsOrSolarIs
(Boolean processed, Integer natal, Integer solar);
is inconsistent. The name implies that processed
is equal to true
, and at the same time there is a processed
parameter.
Do either this:
List<AspectEs> findAllByProcessedIsTrueAndNatalIsOrSolarIs
(Integer natal, Integer solar);
or:
List<AspectEs> findAllByProcessedIsAndNatalIsOrSolarIs
(Boolean processed, Integer natal, Integer solar);
However, you are mixing and
and or
conditions here, which will lead to the following evaluation order:
(processed = value and natal = value) or (solar = value)
That's probably not what you want.