Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

dettection of duplicate contacts

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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. ???

Regards,
Nrapendra.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

CU
Froestel
 
reply
    Bookmark Topic Watch Topic
  • New Topic