Hi,
I have a scenario like this
I have a Many to One relation from Child to Parent.I am loading a list of Child using an object of Parent p using Criteria API
e.g
Code:
public List<Child> getBs(Parent p){
Session session = sessionFactory.getCurrentSession();
Criteria hqlCriteria = session.createCriteria(Child.class);
hqlCriteria.add(Restrictions.eq("parent.id", parent.getId()));
Lis<Child> myList = hqlCriteria.list();
return myList;
Now the issue is , inside the list myList , i can see that the Child objects returned is associated with a new Parent object , but not with the object I passed in i.e p. I have overrode equals and hashCode. But doesnt seems like those are invoked.
Can anybody suggest whats wrong here?
Shaiju