What is the expected behavior in this scenario?
Mapped superclass:
Code:
@Access(AccessType.FIELD)
@MappedSuperclass
public class A {
private long id;
@Access(AccessType.PROPERTY)
@Id
@GeneratedValue
@Column(name = "id")
public long getId() {
return this.id;
}
protected void setId(final long id) {
this.id = id;
}
}
Entity:
Code:
@Entity
@Table(name = "b")
/* etc. */
public class B extends A {
@Column(name = "long_description")
private String longDescription;
public String getLongDescription() {
return this.longDescription;
}
public void setLongDescription(final String d) {
this.longDescription = d;
}
}
I am seeing behavior in Hibernate 3.6.6.Final that seems to suggest that the setter for the longDescription property is being called/used rather than the field.
I was under the impression from the JPA 2.0 specification that if the mapped superclass has @Access(AccessType.FIELD) on it, and then selectively overrides certain getters with @Access(AccessType.PROPERTY) that its children would continue to use the default (AccessType.FIELD). But Hibernate is telling me, for example, that the LONGDESCRIPTION column cannot be found--which would only be the case if it were defaulting the column mapping to LONGDESCRIPTION, and it would only default it if it were using the getters and setters here.
Thanks for any clarification.
Best,
Laird