jpa No Dialect mapping for JDBC type:-9
1.自定义个一个继承SQLServerDialect的dialect类
public class MySQLServer2008Dialect extends SQLServer2008Dialect {
public MySQLServerDialect() {
super();
registerHibernateType(Types.NVARCHAR, StringType.INSTANCE.getName());
}
}
2.application.properties中加属性配置:
spring.jpa.database-platform=MySQLServer2008Dialect
注意:application.properties中如有配置:
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.SQLServer2008Dialect
则应把该配置注掉,防止上述自己添加配置不生效。