krs8785
krs8785

Reputation: 1147

HQL Error : with-clause referenced two different from-clause elements

I am trying to run this query which will give me the count but it does seem to work

def query  = "select count(A.id) from Artifact A "+
             "LEFT JOIN A.classification C on (A.id=C.artifactId) "+
             "where C.id IS NULL";
def tc = Artifact.executeQuery(query);

Upvotes: 1

Views: 5026

Answers (1)

Multisync
Multisync

Reputation: 8797

This may help:

def query  = "select count(A.id) from Artifact A "+
             "LEFT JOIN A.classification C "+
             "where C.id IS NULL";
def tc = Artifact.executeQuery(query);

You don't need ON here because Artifact should already be "connected" with classification through mappings.

Upvotes: 8

Related Questions