• Post Reply Bookmark Topic Watch Topic
  • New Topic

@Transient and hashCode/equals ?

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should transient-fields(@Transient) of a Entity-Class
should also be in hashCode/equals-Method?
 
Javid Jamae
Author
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you don't want to include those in the equals/hashCode methods. @Transient fields are not persisted, so a persistent object and a transient object might be equal even though their @Transient fields are different.
 
It would give a normal human mental abilities to rival mine. To think it is just a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!