JDBC类型的No Dialect映射:1111 [英] No Dialect mapping for JDBC type: 1111

查看:4011
本文介绍了JDBC类型的No Dialect映射:1111的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Spring JPA应用程序,使用MySQL作为数据库。我确保所有spring-jpa库,hibernate和mysql-connector-java都被加载。



我正在运行一个mysql 5实例。这是我的application.properties文件的摘录:

  spring.jpa.show-sql = false 
spring。 jpa.hibernate.ddl-auto = create-drop
spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect

spring.datasource.url = jdbc:mysql:// localhost / mydatabase
spring.datasource.username = myuser
spring.datasource.password = SUPERSECRET
spring.datasource.driverClassName = com.mysql.jdbc.Driver

在执行集成测试时,spring会正常启动,但无法创建休眠SessionFactory,但是例外:

  org.hibernate.MappingException:无JDBC类型的Dialect映射:1111 

我认为我的方言应该是Mysql5Dialect,我也尝试了一个明确声明InnoDB的方言,以及两个没有指出版本5的方言选项。但是我总是以相同的'No用于JDBC类型的方言映射:1111'消息。
我的application.properties文件驻留在test / resources源文件夹中。它被JUnit Test跑步者所认可(我以前因为输入错误而得到一个例外)。

我设置的属性是否错误?我找不到这些属性名称的官方文档,但在这个stackoverflow答案中找到了一条提示: https://stackoverflow.com/a / 25941616/1735497



期待您的回答,谢谢!

顺便提一句已经使用spring boot。

解决方案

这里的答案基于SubOptimal的评论:



该错误信息实际上表明,一种列类型不能通过休眠映射到数据库类型。
在我的情况下,它是我在一些实体中用作主键的 java.util.UUID 类型。只需应用注释 @Type(type =uuid-char)(对于postgres @Type(type =pg-uuid)


I'm working on a Spring JPA Application, using MySQL as database. I ensured that all spring-jpa libraries, hibernate and mysql-connector-java is loaded.

I'm running a mysql 5 instance. Here is a excerpt of my application.properties file:

spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect

spring.datasource.url=jdbc:mysql://localhost/mydatabase
spring.datasource.username=myuser
spring.datasource.password=SUPERSECRET
spring.datasource.driverClassName=com.mysql.jdbc.Driver

When executing an integration test, spring startsup properly but fails on creating the hibernate SessionFactory, with the exception:

org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111

I think my dialects should be Mysql5Dialect, I also tried the one explicitly stating InnoDB, and the two dialect options which don't indicate the version 5. But I always end up with the same 'No Dialect mapping for JDBC type: 1111' message. My application.properties file resides in the test/resources source folder. It is recognized by the JUnit Test runner (I previously got an exception because of an typo in it).

Are the properties I'm setting wrong? I couldn't find some official documentation on these property names but found a hint in this stackoverflow answer: https://stackoverflow.com/a/25941616/1735497

Looking forward for your answers, thanks!

BTW The application is already using spring boot.

解决方案

Here the answer based on the comment from SubOptimal:

The error message actually says that one column type cannot be mapped to a database type by hibernate. In my case it was the java.util.UUID type I use as primary key in some of my entities. Just apply the annotation @Type(type="uuid-char") (for postgres @Type(type="pg-uuid"))

这篇关于JDBC类型的No Dialect映射:1111的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆