Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Inner Join and unique results  RSS feed

 
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?
 
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
Boost this thread!