I want to get event id's for events with property messageUUID
equal to passed value from function.
metaProperties
is a hashmap with keys:
"messageId"
"messageType"
"messageUUID"
and many events will have the same messageId
as messageUUID
values, and when I try to Query for events where key is messageUUID
and value of it is equal to the one I'm searching for - it gives error
@Query("select event.id from EventLogDb event where (key(event.metaProperties) = 'messageUUID' and :message in VALUE(event.metaProperties))")
Slice<EventLogDb> findAllByMessage(
String message, Pageable pageable);
ERROR: more than one row returned by a subquery used as an expression
So as far as I understand - it's because :message in VALUE(event.metaProperties)
gives two results - for keys called messageId
and messageUUID
, as they have the same values.
How should I correct this Query to get it working properly?