You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I've problems using QueryCreation process in Spring Data JPA:
Spring Boot 2.6.5
spring-boot-starter-data-jpa
Hibernate ORM core version 5.6.7.Final
Hibernate Commons Annotations {5.1.2.Final}
Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
public interface MyRepository extends CrudRepository<Entity, EntityId> {
// This methods runs successfully
@Query("SELECT e FROM Entity e WHERE e.param1 like %?1% or e.param2 like %?1%")
List<Entity> findUsingQuery(String term);
// This methods runs OK at first call, fails at consecutive calls
// "Parameter value [\\] did not match expected type [java.lang.String (n/a)]"
List<Entity> findByParam1ContainingOrParam2Containing(String param1, String param2);
}
Obviously, I'm using the first occurence but why fails the second during next consecutive calls?? Check that I'm using only one term at first occurence and reusing the same term at the second occurence:
// select generatedAlias0 from Entity as generatedAlias0 where ( generatedAlias0.param1 like :param0 escape :param1 )
// or ( generatedAlias0.param2 like :param2 escape :param3 )
repository.findUsingQuery("term");
// select generatedAlias0 from Entity as generatedAlias0 where ( generatedAlias0.param1 like :param0 escape :param0 )
// or ( generatedAlias0.param2 like :param2 escape :param1 )
repository.findByParam1ContainingOrParam2Containing("term","term");
Regards,
Antonio.
The text was updated successfully, but these errors were encountered:
Hi! I've problems using QueryCreation process in Spring Data JPA:
Spring Boot 2.6.5
spring-boot-starter-data-jpa
Hibernate ORM core version 5.6.7.Final
Hibernate Commons Annotations {5.1.2.Final}
Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
Obviously, I'm using the first occurence but why fails the second during next consecutive calls?? Check that I'm using only one term at first occurence and reusing the same term at the second occurence:
Regards,
Antonio.
The text was updated successfully, but these errors were encountered: