Left connections in HQL are only possible if you have a connection between two objects. Since your query imposes a merged entity on a nonempty entity, the inner join will do the same. An inner join with join syntax is also only possible if you have a relationship between two objects. But you can do this by simply adding an equality test to the where clause:
select e from Tvshow e, Tvshow e1
where e.num = e1.num
and e1.code = '024'
and e.code is not null
and e.code != '024'
source
share