和有什么区别:
List cats = session.createCriteria(Cat.class)
.add( Restrictions.like("name", "F%")
.list();
和
List cats = session.createCriteria(Cat.class)
.add( Property.forName("name").like("F%") )
.list();
或者就此而言,之间的区别:
Criteria cr = session.createCriteria(User.class)
.setProjection(Projections.projectionList()
.add(Property.forName("id").as("id"))
.add(Property.forName("name").as("name"))
和
Criteria cr = session.createCriteria(User.class)
.setProjection(Projections.projectionList()
.add(Projections.property("id"), "id")
.add(Projections.property("Name"), "Name"))