I want to detect duplicate contacts in my db. Duplicates can be on the basis of name, email, mobilenumber ...
And finally i want result in form of a collection of group.
e.g Group1 with common name n1 containing contacts founded by this name,
Group2 with common name n2 containing contacts founded by this name,
Group3 with common email e1 containing contacts founded by this email .. and so on
What will be the best way of doing it using hibernate. ???
posted 7 years ago
Hi Nrapendra Sharma,
it would possibly be the same as in SQL, use a count() query on each of your fields in question. Something like
I haven't tested this code, not even syntax checked.
This should give you a two column result set with the first column providing the value and the second the count how often it occurs.
I'd suggest a single query for each of the fields - otherwise it gets rather complicated.