【发布时间】:2019-05-10 20:10:42
【问题描述】:
我正在使用 Spring Boot 将表映射到 POJO,但出现以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [com/mercadolibre/linters/db/config/DbaConfig.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [linter_summary] in table [result]; found [json (Types#CHAR)], but expecting [varchar(255) (Types#VARCHAR)]
数据库中的字段linter_summary 是JSON 类型,而在我的pojo 上是一个字符串。我不明白为什么会出现这个错误,Java 中是否有用于 JSON 字段的特殊变量?
【问题讨论】:
标签: java mysql json hibernate spring-boot