We have a query with the following parts:
The second one that doesn't have any parentheses is generated properly
But the first part becomes
Currently the workaround is to add the parentheses, so I'm submitting this as minor priority, but it's my understanding that the JPA implementation is supposed to add them.
Note that this is in a Named Native Query. It might work in JPQL queries, but we don't use them, because it's much harder to develop and test them in pgAdmin