I want to get a distinct result based on a property, but return the id in the select because I will be using it in a subquery.
e.g.
(List<Article>) session.createQuery("from Article a where a.id in (select distinct a2.title from article a2 where a2.body = :body");
setString("body", "")
.list();
The key section is the subquery, I want to return the id, not the a2.title property. Can this be done?
(the table Article has duplicates, so I just want to return any one of them it doesn't matter as long as the body = "").