I have an entity called "UserDetails" that has the following variables:
1) String userId 2) String userName 3) UserContact userContact (where UserContact is the class Embeddable)
UserContact has the following variables:
1) String phone number 2) Email String 3) String city
What will be the sleeping criteria for getting the following list:
Users with username = 'sam' and with city = 'New York'
I tried the following and received a run-time exception that did not recognize the 'city' variable:
List<UserLogin> list = session.createCriteria(UserLogin.class).add(Restrictions.eq("userName","sam")).add(Restrictions.eq("city", "New York")).list();
orm hibernate hibernate-criteria
Biman tripathy
source share