我正在使用spring boot将表Map到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
在db中是json类型,在我的pojo中是字符串。我不明白为什么会出现这样的错误,java中是否有一个特殊的变量用于json字段?
1条答案
按热度按时间2uluyalo1#
添加此maven依赖项:
接下来,将此注解添加到实体类:
然后将其添加到列定义中:
哪里
@Type
是org.hibernate.annotations.Type
有关解释,请参阅本文