im trying to implement a filter/search function based on attributes that can be null, i have this so far:
@Query("""
select a from Item a where
(?1 is null or a.name LIKE %?1%)
and (?2 is null or a.brand LIKE %?2%)
and (?3 is null or a.condition = ?3)
and (?4 is null or a.price = ?4)
and (?5 is null or a.size LIKE %?5%)
""")
Page<Item> findFilteredIgnoreCase(Pageable page, String name, String brand, Condition condition, BigDecimal price, String size);
i have tried using LIKE LOWER(CONCAT()) which works if i add it just for the first attribute but as soon as i add to the others i get the following error: function lower(bytea) doest not exist.
does anyone know how to fix this? or if there is a better way to implement a search function please let me know. Thanks