I have an entity "UserDetails" which has the following variables:
- String userId
- String userName
- UserContact userContact (where UserContact is an Embeddable class)
UserContact has the following variables:
- String phoneNumber
- String email
- String city
What will be a Hibernate Criteria for fetching the following list:
Users with userName = 'sam' and with city = 'New York'
I tried the following and got the runtime exception that it doesn't recognize the variable 'city':
List<UserLogin> list = session.createCriteria(UserLogin.class)
.add(Restrictions.eq("userName","sam"))
.add(Restrictions.eq("city", "New York"))
.list();