Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Primary keys  RSS feed

 
Jayashree Mohan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we use equals() on a primary key class to determine if two keys refer to the same entity or should we use isIdentical() method only?
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
isIdentical() is for EJBObjects only. You can use equals to compare the primary key as long as both entity beans come from the same home. When you create a primary key class, you are required to implement equals so that this will work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!