title: <expression> expected got <from> in spring-data hibernate
body: <p>Working with spring-data and hibernate and trying to write this request in a repository :</p>
  
  <pre><code>    @Query("select u from AppUser u inner join u.roles r inner join u.contrats c where r = :role and not exists ( from c.project p where p = :project)")
  </code></pre>
  
  <p>My goal is to get List of AppUser (Users) from entity AppUer ,but with a condition , only those who don't have the entity project . </p>
  
  <p>To explain more , there is an entity Contrat between Project and AppUser  , it contains Project project , AppUser appuser .</p>
  
  <p>There is a mapping between one_to_many between AppUser and Contrat(AppUser can have multiple contrats) .</p>
  
  <p>Also a mapping of one_to_many between Contrat and project ( One project can have multiple contrat ) .</p>
  
  <p>The problme is that this request returns a empty list while it should return a list of 12 users as they don't have the specified project i passe to it.</p>
  
  <p>I remark in this request (from c.project p where p = :project) 'from' is underlined with red line saying  : </p>
  
  <pre><code>&lt;expression&gt; expected got &lt;from&gt; in spring-data hibernate.
  </code></pre>
  
  <p>Any idea ? </p>
  
  <p><strong>Edit</strong></p>
  
  <p><em>Entity AppUser</em> </p>
  
  <pre><code>@Entity
  @Data
  @AllArgsConstructor @NoArgsConstructor
  public class AppUser implements Serializable {
  
      @Id @GeneratedValue
      private Long id;
      @Column(unique = true)
      private String username;
      private String password;
      private String prenom;
      private String nom;
      private Long tel;
      private String cin;
      private String email ;
      @ManyToMany(fetch = FetchType.EAGER)
      private Collection&lt;AppRole&gt; roles = new ArrayList&lt;&gt;();
  
  
      @OneToMany(mappedBy = "appUser" )
      @Fetch(value = FetchMode.SUBSELECT)
      @JsonManagedReference(value="appuser-contrat")
      private Collection&lt;Contrat&gt; contrats = new ArrayList&lt;Contrat&gt;();
  
  
  
      public void addToContrats(Contrat contrat){
          this.contrats.add(contrat);
      }
  
  
  }
  </code></pre>
  
  <p><em>Entity Contrat</em></p>
  
  <pre><code>@Entity
  @Data
  @AllArgsConstructor
  @NoArgsConstructor
  public class Contrat implements Serializable{
  
          @Id @GeneratedValue
          private Long id;
          private Date dateDebut ;
          private Date dateFin ;
          private Long idDevloppeur;
          @ManyToOne
          @JoinColumn(name = "Id_Project")
          @JsonBackReference(value="projet-contrat")
          private Project project;
  
          @ManyToOne
          @JoinColumn(name = "Id_AppUser")
          @JsonBackReference(value="appuser-contrat")
          private AppUser appUser;
  
  
  }
  </code></pre>
  
  <p><em>Entity Project</em></p>
  
  <pre><code>@Entity
  @Data
  @AllArgsConstructor
  @NoArgsConstructor
  public class Project implements Serializable{
  
          @Id @GeneratedValue
          private long id;
          private String intitule;
          private String description;
  
          @OneToMany(mappedBy = "project" )
          @Fetch(value = FetchMode.SUBSELECT)
          @JsonManagedReference(value="projet-contrat")
          private Collection&lt;Contrat&gt; contrats  = new ArrayList&lt;Contrat&gt;();
  
  
  
          public void addToContrats(Contrat contrat){
                  this.contrats.add(contrat);
          }
  
  
  
   }
  </code></pre>