This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jboss5 entity bean version 2. new instance return on each get

 
au lai seong
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Migration from Jboss4 to Jboss5 causes entity bean return new object instance.

The following 2 lines return different hash code. This only happen in jboss5. Any configuration for this?
entityBeanHomeObject.getAccount().hashCode();
entityBeanHomeObject.getAccount().hashCode();
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have noticed a similar phenomenon in a completely different situation. It appears that an object's position in the heap might influence the resulting hash value (that is my guess, I didn't pursue the details, so I cannot say for certain). You might have to write your own hashCode method for the account object to get the values to be consistent.
 
au lai seong
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hashcode is to check whether it is same object instance only. I want to get back the same instance. because i will use entityBeanHomeObject.getAccount().setName('A').

entityBeanHomeObject.getAccount().setName('A');
entityBeanHomeObject.getAccount().getName(); //i can not get back A here
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic