I have been using Hibernate for several years, but am not sure about the use of queries and criteria.
I realized that one of the strengths of Hibernate is to control the field name in one place. If I have the following code:
List cats = sess.createCriteria(Cat.class) .add( Restrictions.like("name", "Fritz%") ) .add( Restrictions.between("weight", minWeight, maxWeight) ) .list();
What if I change the "name" of the Cat in a java object?
Even when using a refactor replacement (e.g. in Elipse), it will not detect the element as something that needs to be changed!
If so, how do you maintain field names in Java?
source share