-->
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: Very curious result on comparation
PostPosted: Sun Jun 14, 2009 9:10 am 
Newbie

Joined: Sun Jun 14, 2009 9:06 am
Posts: 1
Hi all!

I was doing some work while I found what's following:

Code:
log.debug("Child Parent: " + admAreaChild.getAddressAdministrativeArea().getIdAdministrativeArea());
      log.debug("PArent id: " +  admAreaParent.getIdAdministrativeArea());
      log.debug((admAreaChild.getAddressAdministrativeArea().getIdAdministrativeArea() == admAreaParent.getIdAdministrativeArea()));
      


The result is very curious:

Code:
15:04:00,523 DEBUG com.level2crm.services.addressvalidator.AddressValidator - Child Parent: 4
15:04:00,523 DEBUG com.level2crm.services.addressvalidator.AddressValidator - PArent id: 4
15:04:00,523 DEBUG com.level2crm.services.addressvalidator.AddressValidator - false



So the question is. If both id's are equal and integers why it returns false on equality compartion?

NOTE: I found that it works with .equal. May it be related to Integer to Integer comparation. Maybe has nothing to do with Hibernate...

Thank you all.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.