Reputation: 10463
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.
Upvotes: 0
Views: 947
Reputation: 2790
Try using
import javax.persistence.Transient;
However, not sure if it will work in hibernate without JPA mode.
Upvotes: 1
Reputation: 18148
Try to mark the property as transient, e.g.
private transient int x;
Upvotes: 3