R
R
Riard Brugekaaim2015-07-30 13:17:11
Java
Riard Brugekaaim, 2015-07-30 13:17:11

How to filter out duplicate values ​​in Hibernate?

There is a table that I need to filter in such a way that the values ​​of one of the columns never repeat.
Looks like I completely forgot how to google, but on the net they always refer to Projections.distinct(), which returns not the entire table, but only the filtered column.
Help me figure it out, or am I configuring this class incorrectly, or should I use something else?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
programmerjava, 2015-07-30
@programmerjava

@Entity
@Table(name="values")
class MyEntity {
 ...
 @Column(unique=true)
 private String myValue;

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question