I'm executing this query (with maxResults=1):
This results in the following SQL:
I expected an implicit join on the parent association, but instead it checks entityId on the base table.
But if I use the old class syntax:
Then it does what I expected:
Thanks for the report. I guess the problem is that Hibernate doesn’t do the implicit join for the parent association which then leads to this wrong behavior. I bet if you use inner join parent p where type(p) = SupervisedTerritory this should work properly.
Yes, explicit join works fine.