Getting "org.hibernate.MappingException: No Dialect mapping for JDBC type: -9" when using Hibernate/JPA in JBoss EAP 6.x/7.x
Issue
I got the ERROR message caused by the foolowing exception "org.hibernate.MappingException: No Dialect mapping for JDBC type: -9" when I use native query in my Hibernate/JPA application:
Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
at org.hibernate.dialect.TypeNames.get(TypeNames.java:76) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.dialect.TypeNames.get(TypeNames.java:99) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:592) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:720) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:602) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:618) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.getResultSet(Loader.java:2070) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1859) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.doQuery(Loader.java:906) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.doList(Loader.java:2550) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.doList(Loader.java:2536) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2366) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.Loader.list(Loader.java:2361) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:340) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1752) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:232) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:157) [hibernate-core-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:268) [hibernate-entitymanager-4.2.17.SP1-redhat-1.jar:4.2.17.SP1-redhat-1]
... 259 more
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
- 7.x
- Hibernate/JPA
- Oracle Database
- Microsoft SQL Server
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.