Merge pull request #5981 from EmanuelCR03/develop

FINERACT-2638: Fix JPQL for Notification
diff --git a/fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapperRepository.java b/fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapperRepository.java
index d33f911..cbf99e3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapperRepository.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/notification/domain/NotificationMapperRepository.java
@@ -47,26 +47,37 @@
             """)
     void markUnreadNotificationsAsRead(@Param("appUserId") Long appUserId);
 
+    // 1. Method for fetching ALL notifications (No read status filter)
     @Query(value = """
             select new org.apache.fineract.notification.data.NotificationData(
-                n.id,
-                n.objectType,
-                n.objectIdentifier,
-                n.actorId,
-                n.action,
-                n.notificationContent,
-                n.isSystemGenerated,
-                nm.createdAt
+                n.id, n.objectType, n.objectIdentifier, n.actorId, n.action,
+                n.notificationContent, n.isSystemGenerated, nm.createdAt
             )
             from NotificationMapper nm
             join nm.notification n
             where nm.userId.id = :appUserId
-            and (:isRead is null or nm.isRead = :isRead)
             """, countQuery = """
             select count(nm)
             from NotificationMapper nm
             where nm.userId.id = :appUserId
-            and (:isRead is null or nm.isRead = :isRead)
+            """)
+    Page<NotificationData> findNotificationDataByUserId(@Param("appUserId") Long appUserId, Pageable pageable);
+
+    // 2. Method for fetching with a SPECIFIC read status (e.g., Unread only)
+    @Query(value = """
+            select new org.apache.fineract.notification.data.NotificationData(
+                n.id, n.objectType, n.objectIdentifier, n.actorId, n.action,
+                n.notificationContent, n.isSystemGenerated, nm.createdAt
+            )
+            from NotificationMapper nm
+            join nm.notification n
+            where nm.userId.id = :appUserId
+            and nm.isRead = :isRead
+            """, countQuery = """
+            select count(nm)
+            from NotificationMapper nm
+            where nm.userId.id = :appUserId
+            and nm.isRead = :isRead
             """)
     Page<NotificationData> findNotificationDataByUserIdAndReadStatus(@Param("appUserId") Long appUserId, @Param("isRead") Boolean isRead,
             Pageable pageable);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationReadPlatformServiceImpl.java
index 26600bb..ea66004 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationReadPlatformServiceImpl.java
@@ -104,8 +104,9 @@
     public Page<NotificationData> getAllNotifications(final SearchParameters searchParameters) {
         final Long appUserId = context.authenticatedUser().getId();
         final Pageable pageable = toPageable(searchParameters);
+        // Use the new method that doesn't filter by isRead, avoiding the NULL parameter type issue
         final org.springframework.data.domain.Page<NotificationData> springPage = this.notificationMapperRepository
-                .findNotificationDataByUserIdAndReadStatus(appUserId, null, pageable);
+                .findNotificationDataByUserId(appUserId, pageable);
         return toFineractPage(springPage);
     }