This query on a repository method
@Query(
"SELECT a FROM AttachmentEntity a " +
"WHERE (:projectId IS NULL OR a.projectId = :projectId) " +
"AND (:attachmentTypes IS NULL OR a.attachmentType IN :attachmentTypes) " +
"AND (:eventType IS NULL OR a.eventType = :eventType) ")
fun getAttachments(
projectId: Int?,
attachmentTypes: List<AttachmentType>?,
eventType: EventType?
): List<AttachmentEntity>
throws this exception, when called:
class java.util.ArrayList cannot be cast to class java.lang.Enum (java.util.ArrayList and java.lang.Enum are in module java.base of loader 'bootstrap')
When I remove :attachmentTypes IS NULL OR
, it works.
Could this be a bug in the hibernate query parser?
I could get around this by building the query inside the method, but is there another way to fix this?
This issue was already reported please see HHH-15968.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With