fix: use COALESCE in audit JPQL to prevent lower(bytea) error
Hibernate passes null search param as bytea type, causing PostgreSQL to fail on LOWER(bytea). COALESCE converts null to empty string. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,8 +26,8 @@ public interface AuditRepository extends JpaRepository<AuditEntity, UUID> {
|
|||||||
AND (:from IS NULL OR a.createdAt >= :from)
|
AND (:from IS NULL OR a.createdAt >= :from)
|
||||||
AND (:to IS NULL OR a.createdAt <= :to)
|
AND (:to IS NULL OR a.createdAt <= :to)
|
||||||
AND (:search IS NULL
|
AND (:search IS NULL
|
||||||
OR LOWER(a.actorEmail) LIKE LOWER(CONCAT('%', :search, '%'))
|
OR LOWER(a.actorEmail) LIKE LOWER(CONCAT('%', COALESCE(:search, ''), '%'))
|
||||||
OR LOWER(a.resource) LIKE LOWER(CONCAT('%', :search, '%')))
|
OR LOWER(a.resource) LIKE LOWER(CONCAT('%', COALESCE(:search, ''), '%')))
|
||||||
ORDER BY a.createdAt DESC
|
ORDER BY a.createdAt DESC
|
||||||
""")
|
""")
|
||||||
Page<AuditEntity> findFiltered(
|
Page<AuditEntity> findFiltered(
|
||||||
|
|||||||
Reference in New Issue
Block a user