SSH框架整合時的bug

1.發生錯誤500,異常報告如下圖:

在這裏插入圖片描述
主要錯誤提示:

Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.

解決方式:

  • 查看註解的事務@Transactional導包是否正確,以及是否在業務層的實現類中開啓事務
  • 我的錯誤是導包錯誤,正確的是import org.springframework.transaction.annotation.Transactional;
  • 注意要在類上方開啓事務。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章