I have a Entity which has a non-transitive property, for this property I have no set/get. If I persist this in the database I get the value for the field with no geter. That means, the entity manager does not care of setter or getter, it just "grab" the value .
the next code snippet show the entity :
After this entity is persisted in the db I have for the stuff variable the value 10. Strange because I don't have a get for.
My question is : why is doing the the jpa container this ? Is this specified in the specifications ?
SCJP, SCJD, SCWCD
Joined: Dec 28, 2006
Because you did put the id annotation on the getter the persistence provider assumes you want to use property based persistence.
I already spot this i the specification (2.2 Persistent Fields and Properties)
The persistent state of an entity is accessed by the persistence provider runtime either via JavaBeans style property accessors (“property access”) or via instance variables (“field access”). Whether persistent properties or persistent fields or a combination of the two is used for the provider’s access to a given class or entity hierarchy is determined as described in Section 2.3, “Access Type”.