I am storing and retrieving Java Entities in a DB using Hibernate.
I need to build up (for the purposes of creating web-page ‘drop-downs’ / ‘lookups’) a list of unique strings.
NB: I don’t really want to retrieve back Entities here as such – I want to run the equivalent of a SQL ‘SELECT DISCTINCT(column) FROM table;’ and get back a list of strings.
Is there a standard Hibernate Idiom for doing this – or should I use another mechanism ?
Hibernate query is supporting that query, you can use either hql or native query to get String.
or
Reference: Hibernate Query