does anyone know if and how the solution for following question (which is written in the JPA API) can be written using the hibernate criteria API?
To be more specific I
Can you give us a more complete schema and query?
Also, Criteria API sucks. Try using QueryDSL, your query might look like:
HibernateQuery q=new HibernateQuery(getSession())
.from(QDiscussion.discussion).from(QDocument.document)
.where(QDocument.document.userName.in(QDiscussion.discussion.userNames))
.list(QDocument.document);