• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

primary keys

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
When to compare primary keys using 'equals' method and when to use isIdentical()?(difference)

Thanks
 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Comparing primary keys is valid only when comparing objects obtained from the same home interface.When objects are obtained from different home interfaces,the client must use the isIdentical method on one of the objects to perform the comparison.
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can compare Primary key class using equals method (if primary key class override equals and hashCode) for testing on entity bean has same value.
but isIdentical method is locate on EJBObject or EJBLocalObject.
You can use isIdentical for session bean or entity bean but if you use primary key equals method you can use only entity bean.
hope this help.
 
Anushe Khan
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh what I know is that equals() is for objects on the same heap and isIdentical() is for objects on the remote heap... That's a simple concept for the difference between equals() and isIdentical()...
Just my 2 cents...
 
    Bookmark Topic Watch Topic
  • New Topic