JBoss EAP 6 has been updated to allow the use of parentheses around composite attribute lists in count-distinct queries in MySQL and other databases. This was not allowed in previous versions of the product and would result in an exception being thrown for PostgreSQL. This release allows the Dialect to use the parentheses as appropriate without throwing an exception.
Created attachment 855112 [details]
Simple pure Hibernate Maven JUnit test
Description of problem:
When a composite key is used a "select count (distinct <entity_type>)" query fails to enclose the column names that make up the key attribute in parenthesis and the following exception is raised:
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: org.postgresql.util.PSQLException: ERROR: function count(character varying, character varying) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Version-Release number of selected component (if applicable):
EAP 6.1.1 and Hibernate 4.2.0.SP1
Steps to Reproduce:
1. Using Hibernate core libraries that include the fix for https://hibernate.atlassian.net/browse/HHH-7165 (introduced in Hibernate 4.1.2), create an entity with a composite key
2. Issue a "select count (distinct <entity_type>)" query
Raises exception above
Should return a numeric count
Corrected upstream and will be a part of the EAP 6.3 component upgrade.
Fixed by upgrade -> ON_QA
verified on EAP 6.3.0.ER1