What you are trying to do is a dynamic query. Think of a @NamedQuery as a PreparedStatement.
I've worked out a solution that takes the named query, gets the query language string from it, replaces the IN parameter and generates another query from the result. This works for me but doesn't seem too efficient.
query = this.manager.createNamedQuery(queryString); org.hibernate.Query hbQuery = ((HibernateQuery) query).getHibernateQuery(); query = this.manager.createQuery(hbQuery.getQueryString().replaceAll(":securityRoles", roles.toString()));