mysql - Spring 与 mySql

标签 mysql spring hibernate spring-boot

我的伙伴有相同的代码,但我是唯一遇到此问题的人。 我有相同的 mySql 和 Spring 版本。这是我得到的异常:

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是@Controller

谢谢

最佳答案

您只是在数据库表中没有列roles。您应该更新您的数据库。您可以使用hibernate.hbm2ddl.auto=update

关于mysql - Spring 与 mySql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42739905/

相关文章:

php - 空值被插入数据库

mysql - 名称错误 : cannot load Java class com. mysql.jdbc.Driver

java - 使用 CXF 时如何处理 WS 输出中的无效字符?

java - 事务同步

php - 在 Centos 5.9 和 MySQL 5.1 上安装 php5.3

java - 使用 Jackson for Dynatable 自定义 JSON View

spring - Spring JpaRepository 自定义实现是否自动进行事务处理?

java - 已用堆大小持续增加

java - Spring数据jpa中具有复合PK的表的 native 查询

php - Datetimepicker时间日期转换