-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: "No Dialect mapping for JDBC type: -16" question
PostPosted: Fri Jul 24, 2009 9:55 am 
Newbie

Joined: Fri May 01, 2009 5:38 pm
Posts: 8
Hi,

I'm hoping someone can help..

I would like to use hibernate with SQL Server 2008 to perform XQuery style SQL queries. The query works fine in the Management studio, but if I try and execute it inside a hibernate session, I get a "No Dialect mapping for JDBC type: -16" error.

From looking at the stack trace, I'm unable to work out exactly what is going wrong (or what it is trying to Map). I'm going to try the same query just using standard JDBC next, but it would be great to be able to use hibernate for this.

Has anyone else seen this error before (JDBC type -16)? Any ideas what that type is and whether there is a workaround?

I've pasted the stack trace - any advice / info would be most gratefully received. Thanks in advance:

Hibernate: SELECT customerDocs.query('<CustomerOrders> {for $i in //customer let $name := concat($i/@FirstName, " ", $i/@LastName) order by $i/@LastName return <Customer Name="{$name}">{$i/order}</Customer>}</CustomerOrders>') FROM customerData
org.hibernate.MappingException: No Dialect mapping for JDBC type: -16No Dialect mapping for JDBC type: -16

at org.hibernate.dialect.TypeNames.get(TypeNames.java:79)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:104)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:393)
at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:582)
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:508)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:524)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1821)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2232)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2124)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1723)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
at tests.TestOne.main(TestOne.java:35)


Top
 Profile  
 
 Post subject: Re: "No Dialect mapping for JDBC type: -16" question
PostPosted: Fri Jul 24, 2009 9:59 am 
Newbie

Joined: Fri May 01, 2009 5:38 pm
Posts: 8
In case it helps - here's all the info from my log up until the Exception:

08:39:50,130 INFO TestOne:17 - Query: SELECT customerDocs.query('<CustomerOrders> {for $i in //customer let $name := concat($i/@FirstName, " ", $i/@LastName) order by $i/@LastName return <Customer Name="{$name}">{$i/order}</Customer>}</CustomerOrders>') FROM customerData
08:39:50,169 INFO Environment:560 - Hibernate 3.3.2.GA
08:39:50,172 INFO Environment:593 - hibernate.properties not found
08:39:50,175 INFO Environment:771 - Bytecode provider name : javassist
08:39:50,180 INFO Environment:652 - using JDK 1.4 java.sql.Timestamp handling
08:39:50,242 INFO Configuration:1474 - configuring from resource: /hibernate.cfg.xml
08:39:50,243 INFO Configuration:1451 - Configuration resource: /hibernate.cfg.xml
08:39:50,343 INFO Configuration:1589 - Configured SessionFactory: null
08:39:50,353 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
08:39:50,353 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 20
08:39:50,354 INFO DriverManagerConnectionProvider:68 - autocommit mode: false
08:39:50,482 INFO DriverManagerConnectionProvider:103 - using driver: com.microsoft.sqlserver.jdbc.SQLServerDriver at URL: jdbc:sqlserver://192.168.0.197:1433;databaseName=hib-test;selectMethod=cursor
08:39:50,482 INFO DriverManagerConnectionProvider:109 - connection properties: {user=db_user, password=****}
08:39:51,426 INFO SettingsFactory:114 - RDBMS: Microsoft SQL Server, version: 10.00.1600
08:39:51,427 INFO SettingsFactory:115 - JDBC driver: Microsoft SQL Server JDBC Driver 2.0, version: 2.0.1803.100
08:39:51,465 INFO Dialect:175 - Using dialect: org.hibernate.dialect.SQLServerDialect
08:39:51,556 INFO TransactionFactoryFactory:62 - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
08:39:51,558 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
08:39:51,558 INFO SettingsFactory:161 - Automatic flush during beforeCompletion(): disabled
08:39:51,558 INFO SettingsFactory:165 - Automatic session close at end of transaction: disabled
08:39:51,559 INFO SettingsFactory:180 - Scrollable result sets: enabled
08:39:51,559 INFO SettingsFactory:188 - JDBC3 getGeneratedKeys(): enabled
08:39:51,559 INFO SettingsFactory:196 - Connection release mode: auto
08:39:51,560 INFO SettingsFactory:223 - Default batch fetch size: 1
08:39:51,560 INFO SettingsFactory:227 - Generate SQL with comments: disabled
08:39:51,560 INFO SettingsFactory:231 - Order SQL updates by primary key: disabled
08:39:51,561 INFO SettingsFactory:235 - Order SQL inserts for batching: disabled
08:39:51,561 INFO SettingsFactory:397 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
08:39:51,563 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
08:39:51,564 INFO SettingsFactory:243 - Query language substitutions: {}
08:39:51,564 INFO SettingsFactory:248 - JPA-QL strict compliance: disabled
08:39:51,564 INFO SettingsFactory:253 - Second-level cache: enabled
08:39:51,564 INFO SettingsFactory:257 - Query cache: disabled
08:39:51,571 INFO SettingsFactory:382 - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
08:39:51,572 INFO SettingsFactory:267 - Optimize cache for minimal puts: disabled
08:39:51,572 INFO SettingsFactory:276 - Structured second-level cache entries: disabled
08:39:51,576 INFO SettingsFactory:296 - Echoing all SQL to stdout
08:39:51,577 INFO SettingsFactory:305 - Statistics: disabled
08:39:51,577 INFO SettingsFactory:309 - Deleted entity synthetic identifier rollback: disabled
08:39:51,577 INFO SettingsFactory:324 - Default entity-mode: pojo
08:39:51,578 INFO SettingsFactory:328 - Named query checking : enabled
08:39:51,619 INFO SessionFactoryImpl:193 - building session factory
08:39:51,625 INFO SessionFactoryObjectFactory:105 - Not binding factory to JNDI, no JNDI name configured
08:39:51,712 DEBUG SQL:111 - SELECT customerDocs.query('<CustomerOrders> {for $i in //customer let $name := concat($i/@FirstName, " ", $i/@LastName) order by $i/@LastName return <Customer Name="{$name}">{$i/order}</Customer>}</CustomerOrders>') FROM customerData
Hibernate: SELECT customerDocs.query('<CustomerOrders> {for $i in //customer let $name := concat($i/@FirstName, " ", $i/@LastName) order by $i/@LastName return <Customer Name="{$name}">{$i/order}</Customer>}</CustomerOrders>') FROM customerData
org.hibernate.MappingException: No Dialect mapping for JDBC type: -16No Dialect mapping for JDBC type: -16


Top
 Profile  
 
 Post subject: Re: "No Dialect mapping for JDBC type: -16" question
PostPosted: Sat Jul 25, 2009 11:49 am 
Newbie

Joined: Fri May 01, 2009 5:38 pm
Posts: 8
If anyone is interested, I managed to get rid of the -16 issue by casting the result to an Hibernate.STRING


Top
 Profile  
 
 Post subject: Re: "No Dialect mapping for JDBC type: -16" question
PostPosted: Fri Mar 30, 2012 9:54 am 
Newbie

Joined: Fri Mar 30, 2012 9:51 am
Posts: 2
This is because org.hibernate.dialect.Dialect does not have boolean type registered. You can extend and register yout own Dialect add add boolean to it. Here is a reference: http://www.codesmell.org/blog/2008/12/h ... -booleans/. Hope this may be helpful.


Top
 Profile  
 
 Post subject: Re: "No Dialect mapping for JDBC type: -16" question
PostPosted: Fri Mar 30, 2012 9:55 am 
Newbie

Joined: Fri Mar 30, 2012 9:51 am
Posts: 2
This is because org.hibernate.dialect.Dialect does not have boolean type registered. You can extend and register yout own Dialect add add boolean to it. Here is a reference: http://www.codesmell.org/blog/2008/12/h ... -booleans/. Hope this may be helpful.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.