javax.persistence.transient和java.bean.transient是否做同样的事情? [英] Do javax.persistence.transient and java.bean.transient do the same thing?
问题描述
javax.persistence.transient
注释和 java.beans.transient
注释是否做同样的事情?我知道后者仅在Java 7中引入。我只是很好奇,因为我们最近升级到了我们的服务器上的Java 7,我想知道Hibernate是否可以与任一注释一样工作。正如@Wundwin Born之前所说:
javax.persistence.transient将确保Hibernate将忽略该特定字段,将其保存到数据库中,反之亦然。
java.beans.transient将确保特定字段将被编码器忽略(源自编码器)。请参阅 http://docs.oracle.com/javase/ 7 / docs / api / java / beans / Transient.html
Does the javax.persistence.transient
annotation and the java.beans.transient
annotation do the same thing? I know that the latter was only introduced in Java 7. I'm just curious as we recently upgraded to Java 7 on our servers and I'm wondering if Hibernate will work the same with either of the annotations.
As @Wundwin Born said before:
javax.persistence.transient will make sure that Hibernate will ignore that particular field from saving it into the db and vice-versa.
java.beans.transient will make sure that the particular field will be ignored by the encoders (derived from Encoder). See http://docs.oracle.com/javase/7/docs/api/java/beans/Transient.html
这篇关于javax.persistence.transient和java.bean.transient是否做同样的事情?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!