2

Why a Hibernate persistence object in Java is marked serializable

2 Answers 2

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.)

1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.