Uploaded image for project: 'Hibernate ORM'
  1. HHH-11042

Cannot count distinct on SQL Server on embedded ids

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 5.0.10, 5.2.0, 5.2.1, 5.2.2
    • Fix versions: None
    • Labels:
      None
    • Last commented by a user?:
      true
    • Sprint:

      Description

      Regardless of having supportsTupleDistinctCounts returning false on the selected dialect, Hibernate tries to do a COUNT(DISTINCT col1_, col2_) when counting entities with an embedded id and the JDBC driver throws a Incorrect syntax near ',' exception.

      I suppose this is a limitation of SQL Server, but in my opinion this should not throw an exception and also it should be somehow possible to instruct the dialect to replace the COUNT(DISTINCT col1_, col2_) syntax with a COUNT(DISTINCT CHECKSUM(col1_, col2_)) which may work even in SQL Server.

      This was initially discussed within HHH-7165 Closed .

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: