其他分享
首页 > 其他分享> > 在实体类中临时返回特定字段@Transient

在实体类中临时返回特定字段@Transient

作者:互联网

指定不持久化特定字段

如果我们想让 secrect 这个字段不被持久化,可以使用 @Transient 关键字声明。
一般使用注解的方式比较多。
Entity(name="USER")
public class User {
......
@Transient
private String secrect; // not persistent because of @Transient
}

标签:实体类,持久,......,Transient,because,secrect,特定
来源: https://blog.csdn.net/had__had/article/details/120565263