Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner Join and unique results

 
Wojciech Sielski
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to retrieve data from database using criteriabuilder. It's working great, query is almost perfect... almost. Unfortunately Java don't want me to use group by or distinct as a result of my query. How to make Java retrieve only unique records? My code is here:



Any idea?
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error are you getting?

See,
http://en.wikibooks.org/wiki/Java_Persistence/Criteria#Group_By

For Criteria groupBy examples.
 
Wojciech Sielski
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There was no error. Just duplicated records. But now I've found bug. I was creating query before I've set distinct parameter to true.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic