@Access is ignored by EclipseLink, works fine in sleep mode


I have Entity with @EmbeddedIdin the field, and I override the access type for the field making it Propertyavailable. But this is ignored EclipseLink, Hibernatethis is normal. Netbeans also shows me an error because of this:

The class must use a consistent access type (field or property).
There is no identifier for this entity hierarchy.

@EmbeddedId
private OneId id;

@Transient
private String cosmin;

@Access(AccessType.PROPERTY) // ??
public String getCosmin() {
    return cosmin;
}

public void setCosmin(String cosmin) {
    this.cosmin = cosmin;
}
+3
source share
1 answer

The problem is that the entity skips the following class level annotation:

@Access(AccessType.FIELD)

@Entity. , , . , @EmbeddedId .

JPA 2.0 :

, undefined.
...
Access (FIELD) , . , ().

.

+5

All Articles