Why composite-id class must implement Serializable?

前端 未结 1 1108
挽巷
挽巷 2020-11-29 22:46

If I make a composite-id class which doesn\'t implement Serializable like:

@Entity
@Table(name = \"board\")
public class Board {
    @Id
    @Column(name = \         


        
相关标签:
1条回答
  • 2020-11-29 23:37

    The session object needs to be serializable hence all objects referenced by it must be serializable as well. The id is used as a key to index loaded objects in the session. In case of CompositeId s the class itself is used as the id.

    0 讨论(0)
提交回复
热议问题