Eloy
Eloy

Reputation: 3

Spring with mySql

My partners have the same code, but i am the only one that has this problem. I have the same mySql and Spring version. Here's the exception I get:

org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'dataBaseUsage': Invocation of init method failed; 
  nested exception is 
  org.springframework.dao.InvalidDataAccessResourceUsageException: 
  could not execute statement; SQL [n/a]; nested exception is
  org.hibernate.exception.SQLGrammarException: could not execute statement

Caused by: org.springframework.dao.InvalidDataAccessResourceUsageException: 
could not execute statement; SQL [n/a]; nested exception is 
org.hibernate.exception.SQLGrammarException: could not execute statement

Caused by: org.hibernate.exception.SQLGrammarException: 
could not execute statement

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 
Unknown column 'roles' in 'field list'

DataBaseUsage is @Controller

Thank you

Upvotes: 0

Views: 91

Answers (2)

v.ladynev
v.ladynev

Reputation: 19956

You just don't have column roles in the database table. You should update your database. You can use hibernate.hbm2ddl.auto=update.

Upvotes: 1

Miguel Marzo
Miguel Marzo

Reputation: 75

Looks like a mapping error to me, check the names of the entity, the pojo fields, the database fields names (if its set to create it). Make sure they all match, maybe something about capital letters. Im afraid I cant provide further help with that little info.

Upvotes: 0

Related Questions