This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Problem in Constructor Expressions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem in Constructor Expressions" Watch "Problem in Constructor Expressions" New topic
Author

Problem in Constructor Expressions

Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
select NEW org.UserDto(distinct(orgreg.contactNumber)) from OrganisationRegistration orgreg

Hi
The above query throws runtime exception due to distinct keyword.

Is there any solution available.

Thanks
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
DISTINCT only applies to the entire query (the only exception is its usage with an aggregate function).

Select distinct NEW org.UserDto(orgreg.contactNumber) from OrganisationRegistration orgreg


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem in Constructor Expressions
 
Similar Threads
Game on SQL
Query Question
need 2 rows rather than 5 from this query
Tell me this Logic
Complicated SQL query help