0

I don't understand, does Spring JPA relies on Hibernate? If I use Spring JPA, should I have any of Hibernate configuration stuff?

I am accessing database with Spring JPA, I have configured mappings with Java annotations and one of my fields are annotated in the following way:

   private String annotationClusterColorVerify;

   @Basic
   @Column(name = "annotationClusterColorVerify")
   public String getAnnotationClusterColorVerify() {
      return annotationClusterColorVerify;
   }

   public void setAnnotationClusterColorVerify(String annotationClusterColorVerify) {
      this.annotationClusterColorVerify = annotationClusterColorVerify;
   }

In database it has the following declaration:

annotationClusterColorVerify TEXT;

Nevertheless, I have the following error while initializing:

2016-03-22 15:57:12.969  INFO 15216 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2016-03-22 15:57:13.019  INFO 15216 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2016-03-22 15:57:13.124  INFO 15216 --- [           main] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
2016-03-22 15:57:14.003  INFO 15216 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-03-22 15:57:14.179  WARN 15216 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 1054, SQLState: 42S22
2016-03-22 15:57:14.179 ERROR 15216 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : Unknown column 'ct0_.annotation_cluster_color_verify' in 'field list'
2016-03-22 15:57:14.184  WARN 15216 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Warning Code: 1054, SQLState: 42S22
2016-03-22 15:57:14.184  WARN 15216 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : Unknown column 'ct0_.annotation_cluster_color_verify' in 'field list'
2016-03-22 15:57:14.193 ERROR 15216 --- [           main] o.s.boot.SpringApplication               : Application startup failed

Apparently, it had decided to use undercored version of column name somehow.

Why and how to fix?

Note that I am trying to avoid using of any configuration files. Currently I have only application.properties where I described database only:

spring.datasource.url=MYURL
spring.datasource.username=MYUSER
spring.datasource.password=MYPWD
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
  • 1
    Spring Data JPA is NOT a JPA implementation; nothing more than a wrapper over the JPA API. You have to define WHAT JPA implementation you are using. I'd expect Spring docs to cover that – Neil Stockton Mar 22 '16 at 14:19
  • Possible duplicate of [hibernate column name issues](http://stackoverflow.com/questions/376093/hibernate-column-name-issues) – Dragan Bozanovic Mar 22 '16 at 23:53

0 Answers0