Why a Hibernate persistence object in Java is marked serializable
asked Dec 2, 2010 at 6:31
Victor
17.2k75 gold badges247 silver badges443 bronze badges
2 Answers 2
Quoting Java Persistence with Hibernate:
Hibernate doesn’t require that persistent classes implement Serializable. However, when objects are stored in an HttpSession or passed by value using RMI, serialization is necessary. (This is likely to happen in a Hibernate application.)
answered Dec 2, 2010 at 6:39
darioo
47.4k10 gold badges79 silver badges104 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Because almost always your data objects crosses the machine that contains your data access code. So your objects should be serialized here and deserialized in distant machine to be used.
answered Dec 2, 2010 at 6:35
Jahan Zinedine
14.9k5 gold badges49 silver badges74 bronze badges
Comments
default