[英]Is there a way *not* to persist a field with Siena
I use siena with google engine. 我将siena与Google引擎一起使用。 I have a model class with a field (named
secret
) that I don't want to be persisted. 我有一个模型类,带有一个我不想
secret
的字段(名为secret
)。 (I don't want the column to be created in the google datastore) (我不希望在Google数据存储区中创建该列)
Something along the lines of 遵循以下原则
Class person {
@Id
public Long id ;
public String name ;
@Ignore
public String secret ;
}
The field secret
has to be public. 现场
secret
必须公开。
Do you have any idea to achieve that ? 你有什么想法要实现吗?
You can use Java's transient keyword: 您可以使用Java的暂时关键字:
public transient String secret;
That should stop it from being persisted. 那应该阻止它持续存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.