It's not a secret anymore!
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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem in Constructor Expressions" Watch "Problem in Constructor Expressions" New topic

Problem in Constructor Expressions

Gowher Naik
Ranch Hand

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

The above query throws runtime exception due to distinct keyword.

Is there any solution available.

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
I agree. Here's the link:
subject: Problem in Constructor Expressions
It's not a secret anymore!