Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

@EmbeddedId / equals() / hashCode()

 
Alexandre Fradin
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Here an excerpt of persistence specs (2.1.4) :

The primary key class must define equals and hashCode methods. The semantics of value
equality for these methods must be consistent with the database equality for the database types
to which the key is mapped.

In case of @IdClass, the primary key class have to implement equals() and hashCode() methods.

For @EmbeddedId which class have to implement those methods, entity or embedded class?


Thanks for help.
[ August 11, 2008: Message edited by: Alexandre Fradin ]
 
krishna bulusu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class with @Embeddable annotation i.e. Embeddable class.
 
What are you doing? You are supposed to be reading this 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!