HQL Statement:
String hql = "SELECT DISTINCT track FROM TrackEntity track " +
"LEFT JOIN track.releaseRelations releaseRelation " +
"LEFT JOIN releaseRelation.release.publisherProducerArtists releaseArtist " +
"LEFT JOIN releaseArtist.person releaseArtistPerson " +
"LEFT JOIN releaseRelation.release.publisherProducerGroupCasts releaseGroupCast " +
"LEFT JOIN releaseGroupCast.artistRelations releaseGroupCastArtistRelations " +
"LEFT JOIN releaseGroupCastArtistRelations.artist.person releaseGroupCastPerson " +
"WHERE (releaseArtistPerson.id <> " + personId +
" OR releaseArtistPerson.id IS null) " +
"AND (releaseGroupCastPerson.id <> " + personId +
" OR releaseGroupCastPerson.id IS null ) "
The goal is to find all tracks where the person is not related to. So the person should not be in the publisherProducerArtists and publisherProducerGroupCasts.
The WHERE-statement filters out just the one row where the personId is equal. But if one row is equal, all rows of this track should be filtered out. Probably I need something like NOT IN? But then I have to use SUBSELECTs right?
What is the common way to solve this?
Thanks for help :)