-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: equals and hashCode not invoked
PostPosted: Wed Oct 14, 2009 8:53 pm 
Newbie

Joined: Sun Feb 18, 2007 1:05 pm
Posts: 16
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.