Specfiy columns which should be considered for distinct calculation

Viewed 7139

I'm using javax.persistence.criteria.CriteriaBuilder and javax.persistence.criteria.CriteriaQuery to select some entities.

I now want to select only the entities that are unique which should be specified by a certain column.

There is the method javax.persistence.criteria.CriteriaQuery#distinct which only returns unique entities.

I would rather need something like

CriteriaQuery<T> distinct(String... columnNames)

Do you know how I can bake such a distinct in my JPA CriteriaQuery?

It seems to be possible with Hibernate.

2 Answers
Related