Hi there, I'm still having some doubt on where to place the annotation in an entity's property.
My IDE (NetBeans 6), automatically add the annotations just above the property, while many tutorials out there annotate the relative getter.
Is there any particular case when we should annotate the property instead of its getter method?
Thanks in advance
trying to decode a woman mind....
Shailesh Kini
Ranch Hand
Joined: Oct 17, 2001
Posts: 153
posted
0
Alessandro,
You can either use annotations either on the field level or property (access method) never both. JPA does not like a hybrid approach. Technical articles on the sun site quotes. "In the Java Persistence API, an entity can have field-based or property-based access. In field-based access, the persistence provider accesses the state of the entity directly through its instance variables. In property-based access, the persistence provider uses JavaBeans-style get/set accessor methods to access the entity's persistent properties."