SpringBoot 使用 Jpa 時No property message found for type **!

SpringBoot 使用 Jpa 時No property message found for type

異常信息

  • 控制檯異常信息:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property message found for type LeavingMessage!] with root cause
  • 控制檯報錯
    在這裏插入圖片描述

錯誤原因

  • Spring不知道或者找不到你定義的某一個參數

解決辦法

  • 這個錯誤只會出現在使用到了有關Jap的相關業務上,仔細檢查一下你定義的參數名,基本就找到了

我的錯誤實例

  • 我的Controller接口,分頁查詢時根據字段 message_time 的時間排序
    在這裏插入圖片描述
  • 我查詢實體裏面的字段信息 爲 messageTime
    在這裏插入圖片描述
  • 很顯然我查詢的時候寫成了數據庫的字段,這裏應該填實體中的字段messageTime,Jpa找不到message_time這個東西所以會報錯
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章