This query didn't work:
– A –
it returned an empty result - but the equivalent query below did work:
– B –
It seams that Hibernate handles the TYPE operator on a attribute (that in may case is of the same class as the root query class) in a bizarre way. Below is a translation of the query A to SQL:
the c.dynamicSuperclass attribute is nether joined in this query and TYPE(c.dynamicSuperclass) is actually treated as TYPE(c).
walec51@walec51-linux:~$ java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b118)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b60, mixed mode)