2017-03-11 9 views
0

パートナーには同じコードがありますが、私はこの問題を抱えています。 私は同じmySqlとSpringバージョンを持っています。ここで私が得る例外があります:mySqlを使用したスプリング

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

ある

+0

多少の移行/スキーマ調整が見当たりませんか?あなたのテーブルの一つがフィールド 'ロール'を見逃しているようです。これはフレームワークとデータベースのバージョンとは関係ありませんが、データベースに格納されているものとは関係ありません。 –

答えて

1

データベーステーブルに列rolesがありません。データベースを更新する必要があります。 hibernate.hbm2ddl.auto=updateを使用できます。

+0

それはそれです。ありがとうございました。 – Eloy

+0

@Eloy大歓迎です –

0

は、エンティティの名前、POJOフィールドをチェックし、私にはマッピング・エラーのように見えるありがとう、データベースが名前をフィールド(それを作成するために設定されている場合)。それらがすべて一致しているか、多分大文字について何かを確認してください。 私は恐れている。

+0

私はそれがエラーコードではないと思う私のパートナーはこのコードが正しく実行されているので – Eloy

+0

ありがとうございます。 – Eloy

関連する問題