[hibernate-dev] Question regarding DISTINCT

Steve Ebersole steve at hibernate.org
Mon Feb 19 09:15:18 EST 2007


The in-memory distincting is actually a temporary solution.  There are a 
few JIRA cases making up the ultimate solution.

But specifically to your questions, the DISTINCT applied to the query is 
intended to limit the data transferred by the JDBC driver from server to 
client, especially on large result sets or across poor networks.  No, 
this is not controllable aside from using a custom query translator.

Michael Barker wrote:
> Hi,
>
> When querying for a list of objects using ejb-ql, the keyword 
> 'distinct' is used to de-duplicate the result set and give a correct 
> list of objects.  However I have noticed that everytime distinct is 
> specifed in the ejb-ql query it also gets specified in the sql query.  
> I am curious as the reasoning behind this.  I understand that distinct 
> is used to remove duplicates from the SQL result set, but from what I 
> can see, for the majority of simple use cases the sql distinct is 
> superflous.  Running the hibernate generated query without the 
> distinct returns the same results.  I assume that the distinct is in 
> there for are reason, are there some more complicated use cases for 
> which the distinct in necessary?
>
> My main concern is performance, is there anyway of performing an 
> ejb-ql "select distinct..." without hibernate issuing an sql "select 
> distinct...".
>
> Regards,
> Michael Barker.
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>



More information about the hibernate-dev mailing list