Le 12/10/2010 20:32, Tom Anderson a ?crit :
You can. You annotate the fields, and the provider accesses them with
reflection or some other mechanism. Some (including myself) consider it
preferable to access via the accessors, because it means you don't have
to have accessors where it's not appropriate (see discussions on
getters, setters and object orientation passim), and you're free to do
clever stuff in them when it is.
Thinking about it, i don't know if this is something the spec
guarantees, or something that implementations happen to support. I'll
check.
It's guaranteed by the spec :
2.1.1 Persistent Fields and Properties
The persistent state of an entity is accessed by the persistence
provider runtime[1] either via JavaBeans style property accessors or via
instance variables. A single access type (field or property access)
applies to an entity hierarchy. When annotations are used, the placement
of the mapping annotations on either the persistent fields or persistent
properties of the entity class specifies the access type as being either
field- or property-based access respectively.
Je suis redevable a votre bienveillance. And needless to say, i am no