No Dialect mapping for JDBC type :0

Data service architecture: spring Roo + hibernate+mysql

When calling the stored procedure, it appears: No Dialect mapping for JDBC type: 0
By decompiling java.sql.Types.java, we know that type:0 corresponds to NULL
  No Dialect mapping for JDBC type :0 - ftutor - ftutor ops

 

The reason is that java.sql.Types in java defines NULL parsing , but hibernate's dialect cannot support it. When using spring roo to configure the project, the jpa used is hibernate, then the default persistent.xml One of the behaviors:
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
This is the dialect used to define hibernate, we can reimplement this dialect and then reassign the value:
No Dialect mapping for JDBC type :0 - ftutor - ftutor ops
 
Then change this property in persistent.xml to the location of the MysqlDialect class and it will be ok
This enables hibernate to support NULL type type values.
 
In addition, we need to make further modifications. In the applicationContext.xml that defines the sessionFactory, we also need to define Dialect to point to our newly defined class to completely solve this problem.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326343677&siteId=291194637