hi everyone, I've a problem with a criteria query and I can't find the solution. can you help me please? the problem is:
I've a class Contact which has a @OnetoOne relation relation which an instance of the class Address mapped on the attribute "address"
now, i need to find the list of the contact which the value of the attribute "city" equals to "xxx"
I tried doing that: List<Contact> results = session.createCriteria(Contact.class) .createCriteria("address") .add(Restrictions.eq("city","xxx")) .list();
but results is empty.
If I just do List<Address> results = session.createCriteria(Address.class) .add(Restrictions.eq("city","xxx")) .list();
results contains all the instances of the class address with the "city" equals to "xxx", but i need the objects of the class Contact
thanks
|