title: In Hibernate for composite-id, why the class should implement Serializable
body: <p>The hibernate document says that the class that we use for composite-id should implement serializable, here is the document link that I am going through: <a href="http://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/mapping.html#mapping-declaration-compositeid" rel="nofollow noreferrer">http://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/mapping.html#mapping-declaration-compositeid</a></p>
  
  <blockquote>
    <p>The persistent class must override equals() and hashCode() to
    implement composite identifier equality. It must also implement
    Serializable.</p>
  </blockquote>
  
  <p>But why it is required to implement serializable?</p>
  
  <p>I have gone through this SO link: <a href="https://stackoverflow.com/questions/9271835/why-composite-id-class-must-implement-serializable">Why composite-id class must implement Serializable?</a></p>
  
  <p>but I am not understanding the answer given there, please help me in understanding the concept here.</p>