title: In hibernate, how to select results from one table while querying multiple tables
body: <p>I want to create a Hibernate query that'll return a list of movies for which James Bond was played by an actor who is now more than 60 years old. (never mind the sillyness of this exemple)</p>
  
  <p>I've tried many combinations with createQuery but can't set a condition on the join.</p>
  
  <p>Also, another goal is I'd like the query to return a List&lt;Movie&gt; instead of List&lt;String&gt; or List&lt;Whatever&gt;.</p>
  
  <p>More specifically, the SQL I'd like to run is as follows:</p>
  
  <pre><code>SELECT m.* FROM movies m
  INNER JOIN movie_actors ma
      ON (ma.movie_id = m.id AND ma.role = 'James Bond')
  INNER JOIN actors a
      ON (a.id = ma.actor_id AND a.age &gt; 60)
  </code></pre>
  
  <p>For this purpose, I assume this table schema :</p>
  
  <pre><code>CREATE TABLE movies(
  id            INTEGER          NOT NULL,
  name          NVARCHAR2(100)    NOT NULL,
  
  CONSTRAINT pk_movies PRIMARY KEY (id),
  );
  
  CREATE TABLE movie_actors (
  movie_id  INTEGER       NOT NULL,
  actor_id  INTEGER       NOT NULL,
  role      NVARCHAR2(200) NOT NULL,
  
  CONSTRAINT fk_movies_actors_movie_id  FOREIGN KEY (movie_id)  REFERENCES movies,
  CONSTRAINT fk_movies_actors_actor_id  FOREIGN KEY (actor_id) REFERENCES actors
  );
  
  CREATE TABLE actors (
    id         INTEGER         NOT NULL, 
    firstname  NVARCHAR2(50)   NOT NULL, 
    lastname   NVARCHAR2(50)   NOT NULL,
    age        INTEGER       NOT NULL,
  
    CONSTRAINT pk_actors  PRIMARY KEY (id)
  );
  </code></pre>