About DISTINCT

manual

SELECT clause (JPQL / Criteria API)

Explains how to use the SELECT clause and projections in a JPA/JPQL query.... Classes (Constructor Expressions) SELECT DISTINCT SELECT in Criteria Queries ... built faster and they consume less memory. SELECT DISTINCT Queries that use projection may return duplicate results. For ...

 
manual

GROUP BY and HAVING clauses

Explains how to use the GROUP BY and HAVING clauses in a JPA/JPQL query.... covers the following topics: GROUP BY as DISTINCT (no Aggregates) GROUP BY with Aggregate Functions ... in Criteria Queries GROUP BY as DISTINCT (no Aggregates) The following query groups all the countries ...

 
api-jpa

distinct(distinct)

Specify whether duplicate query results will be eliminated.(Method of javax.persistence.criteria.CriteriaQuery)

 
api-jpa

distinct(distinct)

Specify whether duplicate query results will be eliminated.(Method of javax.persistence.criteria.AbstractQuery)

 
api-jpa

distinct(distinct)

Specify whether duplicate query results will be eliminated.(Method of javax.persistence.criteria.Subquery)

 
issue

Issue with DISTINCT Select

It is getting more and more frustrating :( We've introduced distinct select instead of regular selection in our code (no changes else) and suddenly receive invalid identifiers in queries exceptions in various queries. Here's the stacktrace: ... getting more and more frustrating :( We've introduced distinct select instead of regular selection in our code (no changes else) and ... Invalid order expression '$3' for distinct results at com.objectdb.o.MSG.d(MSG.java:61) at ... hi, Well, the query works perfect without using distinct select so I doubt its an issue in our query. Here it goes: ...

 
forum_thread

Problem with distinct select, order by and equivalent alias/attribute path

Hi, while working with a (standard-)JPA-query generating framework we run into an exception when ordering the results of some projection when the order by expression is different (though logically equivalent) to the projection expression. Here is the example: ... ;     String q1 = "select distinct s_location " + "from Street s " + ... ( ) ;   q1 = "select distinct s.location " + "from Street s " + ...

 
forum_thread

Multi selection and distinct in a criteria query

hi, How can I realize multi selection with the criteria api concerning distinct? I.e. doing something like SELECT DISTINCT $1, $2 wouldn't work because I do only have something like criteria.multiselect(...) and nothing like builder.distinct(selection) so that I could do something like criteria.multiselect(builder.distinct($1), $2)... ?? Alex ... I realize multi selection with the criteria api concerning distinct? I.e. doing something like SELECT DISTINCT $1, $2 wouldn't work because I do only have something like ...

 
forum_thread

Distinct Error

Hi, I'm getting a NullPointerException thrown on using DISTINCT. The query works fine if I don't have distinct. However thats NOT a solution as the code generating the query is used for other queries, and some of them do need the distinct. Its only a simple query: QUERY: SELECT DISTINCT $1 FROM CDI $1 JOIN $1.attributeList $2 WHERE ($2.name='firstname') AND ($2.valueAsString='Alex') ... I'm getting a NullPointerException thrown on using DISTINCT. The query works fine if I don't have distinct. However thats NOT a solution as the code generating the query is used ...

 
forum_thread

ObjectDB internal error on 2.6.4.b10 for query with DISTINCT

I observed that on new ObjectDb v.2.6.4.b10 query below causes internal exception SELECT DISTINCT $1 FROM Pa3DictionaryItem $2 JOIN $2.values $1 WHERE ($2.namespace == 'com.anritsu.pa3.ttcn3' AND $2.key == 'TliEvent' AND $1 != '') Query above also worked fine on ObjectDb version 2.6.1.b06 Could you comment this? Raised issue: Issue #262 - DISTINCT key causing internal exception on 2.6.4.b10 ... query below causes internal exception SELECT DISTINCT $1 FROM Pa3DictionaryItem $2 JOIN $2.values $1 WHERE ($2.namespace == ... you comment this? Raised issue: Issue #262 - DISTINCT key causing internal exception on 2.6.4.b10 ...