Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Complicated MappedSuperclass/AccessType question

What is the expected behavior in the following case?

I have a mapped superclass annotated with @Access(AccessType.FIELD).

It defines several fields and column mappings.

It features a private long id field, but it is entirely unannotated:

  private long id;

Then there is this:

@Access(AccessType.PROPERTY)
@Id
@GeneratedValue
@Column(name = "id")
public long getId() {
  return this.id;
}

public void setId(final long id) {
  this.id = id;
}

Next, I have an entity that extends this mapped superclass which is as unannotated as possible.  Obviously it features an @Entity tag, but most notably it does not declare an id field or override (yet) the getId() method.

It's my understanding that only for the id property should the getter/setter pair be used; every other field defined in either the mapped superclass or its entity child should use FIELD access.

Is this the experts' understanding as well?

Best,
Laird

Back to the top