1. 程式人生 > >spring boot jpa執行失敗

spring boot jpa執行失敗

程式碼是這樣寫的
在這裡插入圖片描述

@Query(value = "select id from class_board_events WHERE id=?1",nativeQuery = true)
    List<ClassBoardEventEntity> getOne(int id);

返回提示

could not execute query; SQL [select id from class_board_events WHERE id=?]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query

錯誤提示

java.sql.SQLException: Column 'memeber_id' not found.

解決方案:

ClassBoardEventEntity.java裡的 member_id 欄位刪除,因為是返回物件與對應實體裡的不相符