EntityManagerSetupException for multiple joins and a sub query for NamedQuery

28 views Asked by At

I am trying to write a NamedQuery with multiple joins and one sub-Query.

These are my Entities (I have removed most of the columns so that Question doesn't get too long and reader wouldn't need to go through unnecessary columns)

   @Entity
    public class progressEntry implements Serializable {

          @Id
        @GeneratedValue
        private int id;     

    }

@Entity
public class KnowledgeTransfer implements Serializable {
      @Id
    @GeneratedValue
    private int id;

    @ManyToOne
      private progressEntry pEntry;

}

@Entity
public class ColleagueActivity implements Serializable {
    @Id
    @GeneratedValue
    private int id;

    @ManyToOne
      private KnowledgeTransfer knowledgeTransfer;

    @ManyToOne
   private College college;

}

@Entity
public class College implements Serializable {

    @Id
    @GeneratedValue
    private Integer id;

    private Integer studentNumber;

}

When I wrote the Native Query for this one, it works fine but I was wanted to learn how to write a Named Query with this one.

Here is what I tried which throws an Exception:

select progressEntry p where p.id in (select kt.progressEntryId from KnowledgeTransfer kt join ColleagueActivity cc on cc.ktid=kt.id join College c on c.id=cc.colleagueId where c.student.studentNumber= :studentNumber)

Please let me know if there is any more information that you would like me to post.

Thanks in advance.

0

There are 0 answers