I must say, that I disagree with the articles argument about annotating fields rather than getters and setters. By using getter / setter annotation you can specify that a field is to be read from DB (annotate the setter), but never written (don't annotate getter). You can also split a db-field into two fields inside a setter, and join two object fields into one in a getter. In general I personally find using getters / setters a much more flexible mechanism when working with persistence.
Comments
Jakob Jenkov replied ago:
I must say, that I disagree with the articles argument about annotating fields rather than getters and setters. By using getter / setter annotation you can specify that a field is to be read from DB (annotate the setter), but never written (don't annotate getter). You can also split a db-field into two fields inside a setter, and join two object fields into one in a getter. In general I personally find using getters / setters a much more flexible mechanism when working with persistence.
Voters For This Link (23)
Voters Against This Link (0)