-->
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.  [ 2 posts ] 
Author Message
 Post subject: Objects are not the same expected
PostPosted: Wed Aug 27, 2003 8:56 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 8:53 pm
Posts: 34
Hi,

I have a class A which has one-to-many or one-to-one relationships with several other classes. In my test case, I save A to db, then retrieve it using its auto-generated id. When I run my testcases, I got the following AssertionFailedError:
As are not the same expected: A@... but was A@....

I checked both As id, they are the same. I am wondering what caused these two objects to be different while they should be the same? Configuration?

By the way, the associations among A and other objects are bi-directional.

Has anyone encountered this kind of problem?

regards,


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2003 9:00 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Hibernate guarantees identical objects (VM identity be memory location) only in the same Session scope. Use equals() to check for equality.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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

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.