-1
public interface XRepository extends JpaRepository<XEntity, Long> { 
Page<XEntity> findByParentIdAndNameContainingAndDescrContaining(Long parentId,String name, String descr, Pageable pageReq)
}

I'm writing. But it's case-sensitive. The result is wrong. How can I solve?

Hasitha Jayawardana
  • 2,326
  • 4
  • 18
  • 36
Kübra
  • 187
  • 3
  • 10

2 Answers2

0

Put IgnoreCase in the end of the method name.

Guilherme Melo
  • 209
  • 3
  • 13
0

I usually write queries myself so I can better visualize what's going on.

public interface XRepository extends JpaRepository<XEntity, Long> {
    @Query("SELECT xe from XEntity xe where xe.parentId = :parentId and xe.name like concat('%', :name, '%') and xe.description like concat('%', :descr, '%')")
    Page<XEntity> findByParentIdAndNameContainingAndDescrContaining(Long parentId,String name, String descr, Pageable pageReq)
}