Lets say i have 2 classes Person and Address and i have a unidirectional association between them - ie. Person has an Address. My question is, will i be able to get a List of Person objects based on Address or do i need bidirection.
Query along the lines:
Query along the lines:
public static void getPeopleByAddress(String streetName){
AnnotationConfiguration config = new AnnotationConfiguration();
config.addAnnotatedClass(Person.class);
config.addAnnotatedClass(Address.class);
config.configure();
Session session = config.buildSessionFactory().getCurrentSession();
session.beginTransaction();
Criteria criteria = session.createCriteria(Person.class);
//get all people that live on the street name specified in the parameter
criteria.add(Restrictions.????);
List<Person> list = criteria.list();
session.getTransaction().commit();
}