Ho un'entità "UserDetails", che ha le seguenti variabili:Criteri Hibernate per entità con oggetti incorporati
1) String userId 2) String username 3) UserContact userContact (dove UserContact è una classe Embeddable)
UserContact ha le seguenti variabili:
1) String PHONENUMBER 2) String email 3) String città
quello che sarà un Criteri di Hibernate per il recupero il seguente elenco:
Gli utenti con username = 'sam' e con vista sulla città = 'New York'
ho provato quanto segue e ottenuto l'eccezione di runtime che non è così riconoscere la 'città' variabile:
List<UserLogin> list = session.createCriteria(UserLogin.class).add(Restrictions.eq("userName","sam")).add(Restrictions.eq("city", "New York")).list();