File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Inner Join and unique results Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Inner Join and unique results" Watch "Inner Join and unique results" New topic

Inner Join and unique results

Wojciech Sielski

Joined: Dec 18, 2012
Posts: 7

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

Joined: Oct 01, 2007
Posts: 553
What error are you getting?


For Criteria groupBy examples.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Wojciech Sielski

Joined: Dec 18, 2012
Posts: 7
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.
I agree. Here's the link:
subject: Inner Join and unique results
jQuery in Action, 3rd edition