title: JPQL: Parameter with that position [1] did not exist
body: <p>I am working with JPA and JPQL.  Using a JPQL I would like to fetch join a collection that is an attribute of a "main" entity rent. Here is my source code:</p>
  
  <pre><code>    public Rent getRentWithAllDetails(Rent rent) {
  
      Query queryString =  em.createQuery(" select r from Rent r JOIN FETCH r.rentables where r.id = :rid").setParameter(1, rent.getId());
  
      List &lt;Rent&gt; resultList = queryString.getResultList();
  
      return resultList.get(0);
  }
  </code></pre>
  
  <p>and this is the exception I recieve:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Parameter with that position [1] did not exist
  at org.hibernate.jpa.spi.BaseQueryImpl.findParameterRegistration(BaseQueryImpl.java:518) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
  at org.hibernate.jpa.spi.BaseQueryImpl.setParameter(BaseQueryImpl.java:674) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
  at org.hibernate.jpa.spi.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:198) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
  at org.hibernate.jpa.spi.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:49) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
  </code></pre>
  
  <p>Could someone help me, please?</p>