springboot+jpa解決@ManyToOne時,相關bean文件數據被刪除導致數據不存在報錯問題。

主要使用
@NotFound(action=NotFoundAction.IGNORE) 意爲:找不到引用的外鍵數據時忽略
@JoinColumn(nullable = false)
剩餘的標籤都是自己做項目的時候用到的,在此標記一下,以後使用。

爲了以後粘貼方便:
@JsonView({CunOrderList.class, CunProductsDetails.class, OrderTableOrderList.class})
@ManyToOne(fetch = FetchType.LAZY)
@NotFound(action=NotFoundAction.IGNORE)
@JoinColumn(name = “ocean_id”, nullable = false)
@org.hibernate.annotations.ForeignKey(name = “none”)
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章