I have an application that I am being forced to host on a provider that only runs JRE 6.
I get a compilation error on my Hibernate beans that have properties that have been annotated with @Transient
. The compilation error is due to the fact that java.beans.Transient
was introduced in Java 7.
Is there a way to mark a Hibernate property as transient without this annotation? Preferably without having to migrate fully to *.hbm.xml
and abandon annotations altogether? Would it be possible to somehow add just this annotation interface to the classpath of JRE 6 somehow?
If you would like to point out this is impossible on Java 6 and that I should switch hosting providers then please post this as a comment, answers stating this will be downvoted.
尝试将属性标记为瞬态,例如
private transient int x;
Try using
import javax.persistence.Transient;
However, not sure if it will work in hibernate without JPA mode.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.