So I have the following situation:
@Entity
class Image {
@Id
@GeneratedValue
private Long id;
....
}
@Entity
class ImageData implements Serializable {
@Id
@OneToOne
private Image image;
....
}
This is all working fine, but why does ImageData need to be serializable? If it's not I get Exceptions that it needs to be serializable:
org.hibernate.MappingException: composite-id class must implement Serializable:...
I know Identifier need to be serializable but why is it now the other way around?