Hi Daryl, On Jun 11, 2009, at 12:24 PM, Daryl Stultz wrote:
I am using field access. I placed my annotations on the fields simply because I like them there. I didn't realize there was a functionaldifference. Is there any advantage/disadvantage to field vs property access? It seems property access has the potential gotcha, while field does not.Perhaps there is some other cost...
For me, property access should only be used with persistent abstract classes or persistent interfaces. In these cases, the properties are implemented by OpenJPA and the user has no opportunity for mischief.
In the case of non-abstract classes, IMHO using properties mixes two concerns: the client view (which has to use the accessors to get to the data) and the persistence implementation view (which has to use the accessors to store the data in the database). When using property access for non-abstract classes, you can't put business logic into the accessors because this interferes with the persistence implementation's use of the accessors.
HTH, Craig Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:[email protected] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
