Hi
I have two tables, MOVIES and MOVIES_GENRES (also also GENRES that is not important in this topic).
Here's a brief schema:
MOVIES
- MOVIE_ID
- TITLE
MOVIES_GENRES
- MOVIE_ID
- GENRE_ID
Each movie can belong to multiple genres, e.g. drama, action, sci-fi, horror, etc.
Now, I want to be able to get all movies in the "action" and "sci-fi" genre.
I'm trying to do this using a Criteria query, and have the class set-up in xml like this:
Code:
<set cascade="all" inverse="true" name="genres" table="MOVIES_GENRES">
<key column="MOVIE_ID"/>
<many-to-many class="Genre" column="GENRE_ID"/>
</set>
and then where I do the Criteria query:
Code:
criteria.add(Expression.in("genres", new String[] {"sci-fi","action"}));
But of course this is not working, I keep getting: "Missing IN or OUT parameter at index:: 3"
Please help me find my mistake, and/or point me to the best way of accomplishing a query like this.
Thank you.