小编Mah*_*ini的帖子

如何在hibernate中使用UNION执行查询

我正在通过hibernate执行SQL查询,它看起来像:

@Query("(select category from Category category where category.isDelete=false and category.status='A' AND " +
        "category.id in (select cat.id from Category cat where cat.isDelete=false and cat.status='A' and cat.parentCategory IS NOT NULL))" +
        "UNION" +
        "(select category from Category category where category.isDelete=false and category.status='A' and category.parentCategory IS NOT NULL)")
Run Code Online (Sandbox Code Playgroud)

但它显示我的错误

Caused by: java.lang.IllegalArgumentException: node to traverse cannot be null!
Run Code Online (Sandbox Code Playgroud)

java mysql hibernate spring-boot

6
推荐指数
1
解决办法
1928
查看次数

标签 统计

hibernate ×1

java ×1

mysql ×1

spring-boot ×1