Łukasz Rzeszotarski
Łukasz Rzeszotarski

Reputation: 6140

Hibernate @AttributeOverride which results in setting the property as @Transient

Apart from this, if it is the right pattern to do it this way, the question is wheter is possible in a Hibernate for a given @MappedSuperclass set up the overriden property as a @Transient or ignore it in any 'other way'?

Given mapped superclass:

@MappedSuperclass
public abstract class MappedSuperclassEntity {
    private Integer field;
    public Integer getField() {return field;}
    public void setField(Integer field) {this.field = field;}
}

Upvotes: 5

Views: 2064

Answers (1)

K.C.
K.C.

Reputation: 2112

That is not possible. Javadoc of @AttributeOverride :

(Required) The column that is being mapped to the persistent attribute. The mapping type will remain the same as is defined in the embeddable class or mapped superclass.

You can look at one of the three inheritance strategies for JPA here for another design.

Upvotes: 4

Related Questions