I'm using JPA/Hibernate for a few years and they are really useful. but i have some philosophical problems with the design.
the main problem is why should I make all my class properties public(create public setter/getter) just because Hibernate wants to access them even though it can access them without this permission ( through reflection) and in this design getters and setters should be so simple to reduce overhead and then practically they loose their philosophy of being which is controlling access to fields.i.e. in this design getters and setters become shared between Database Access(JPA) and System Domain which need different design criteria. (you probably don'nt need to check a value before setting it to a field when you load it from database because you've done this check before!)
can any body explain any reason for this design? I know that it's helpful in some cases but in most of them it's not.!
just one more problem that it has is that setters are almost useless when loading an object from database as object is partially loaded and there is no order for it( so it almost force us to implement setters so simple and just a copy from input to filed) !
Hibernate can access public, private, and protected accessor methods, as well as public, private and protected fields directly. The choice is up to you and you can match it to fit your application design.See docs.jboss.org/hibernate/orm/3.3/reference/en/html/…