[hibernate-dev] Native SQL queries and unknown JDBC type mappings

Steve Ebersole steve at hibernate.org
Sat Jun 16 12:18:59 EDT 2012


Been seeing a lot of questions lately on StackOverflow about native SQL 
queries and the "No Dialect mapping for JDBC type: XYZ" error.

Is there a reason we don't do a best effort to resolve these using the 
drivers database metadata?  In fact we already read and parse this 
information during JdbcServices init 
(org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData#getTypeInfoSet). 
We could resolve the unknown type to its 
org.hibernate.engine.jdbc.internal.TypeInfo and use the TypeInfo's 
reported javaType to resolve the Hibernate type to use.

WDYT?

Then the dialect really just needs to become involved in the exception 
case(s).  This is really another case of what I want to do eventually 
where we blend information from the JDBC driver's DatabaseMetaData and 
Dialect.

-- 
steve at hibernate.org
http://hibernate.org


More information about the hibernate-dev mailing list