PostgreSQL error with Hint: "No function matches the given name and argument types" using Hibernate in JBoss EAP 6.x

Solution Verified - Updated -

Issue

The following exception is observed when executing a select count (distinct <entity_type>) where the entity type uses a composite key:

org.hibernate.exception.SQLGrammarException: could not extract ResultSet
    at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:122)
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
...
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.
...
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:302)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:56)
...

Environment

  • Hibernate (Core)
    • 4.0.3
    • 4.1.x
    • 4.2.x
    • 4.3.x
  • PostgreSQL
  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.0.0
    • 6.0.1
    • 6.1.1
    • 6.1.2
    • 6.2.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content