此对存储库方法的查询
@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>
调用时抛出此异常:
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')
当我删除:attachmentTypes IS NULL OR
时,它工作了。
这可能是hibernate查询解析器中的一个bug吗?
我可以通过在方法内部构建查询来解决这个问题,但是有没有其他方法来解决这个问题呢?
1条答案
按热度按时间gdx19jrr1#
已报告此问题,请参见HHH-15968。