I have an entity that derives from an interface that defines a getter method. I mark it with @Transient, but still hibernate requires me to
- Define a setter method.
- Does include the field in all queries, causing a crash.
Isn't that what @Transient is for?
public interface Archiveable { @Transient Boolean getArchived(); }
@Entity
@Table(...)
public class Post implements Archiveable {
@Override
@Transient
public Boolean getArchived() {
return false;
}
}
I am pretty sure i am using this very construct in other forms as well.
The @Transient annotation can be applied only to the fields, not the method definitions.