How to execute query with UNION in hibernate

Viewed 6393

I'm performing a SQL query through hibernate, which looks like:

@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)")

But it showing me error

Caused by: java.lang.IllegalArgumentException: node to traverse cannot be null!
2 Answers
Related