出错场景是升级oracle驱动,将版本从ojdbc14升级到ojdbc6,hibernate执行原生态sql语句会报如下错误:
org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
解决方案:
SELECT CAST) as operation,CAST) as functionCode
cast转换数据类型是关键,且只能转换到varchar,转换到nvarchar也会有异常。