I\'m trying to execute this query in JPA and I get an error. However when I set this two UNION queries apart it works fine. Also when I run it in the sql console without passing