This content has been marked as final.
Show 2 replies
-
1. Re: NamedQuery with IN bind variable
bill.burke May 6, 2005 1:01 PM (in response to ryoung2504)What you are trying to do is a dynamic query. Think of a @NamedQuery as a PreparedStatement.
-
2. Re: NamedQuery with IN bind variable
ryoung2504 May 6, 2005 3:36 PM (in response to ryoung2504)Thanks,
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()));