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

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.