[英]Mongo - Ignore property from being persisted
我有一個標准的 POJO,其中包含一組屬性。 POJO 已被注釋為@Document
,以便在 MongoDB 中作為 Document 持久化。
如何(注釋??)我可以忽略/避免 POJO 中的屬性之一被持久化嗎?
如果您正在尋找像我一樣的實際包,這個包會起作用:
import org.springframework.data.annotation.Transient;
來自Spring 框架 API文檔。
但是這個JPA注釋不適用於 MongoDB:
import javax.persistence.Transient;
使用@Transient
注意你使用下面的包
import org.springframework.data.annotation.Transient;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.