Hibernate Serializable classes do not declare serialVersionUID

Description

None of the Serializable classes in Hibernate declare serialVersionUID (see http://www.hibernate.org/hib_docs/v3/api/serialized-form.html#org.hibernate.collection.AbstractPersistentCollection).

This is recommended practice for ALL classes that implement the Serializable interface (see Joshua Bloch's Effective Java - Item #54). Adding these fields is trivial and takes little effort, but is a great enhancement if you are serializing Hibernate classes.

For instance, we upgraded from Hibernate 3.2.2 to 3.2.3 in our production servers. We serialize process state (which sometimes includes references to Hibernate-managed entities) every 30 seconds or so and on shutdown, so in the event of failures or re-deployment, the processes can continue where they left off. We had a huge surprise when deserialization failed completely because AbstractPersistentCollection had slightly changed between the 3.2.2 and 3.2.3 releases, and this caused the automatically-generated default serialVersionUID to change, even though the changes in the serialized form are compatible as far as we can tell.

Environment

Not specific to any database, platform or Hibernate version.

Assignee

Unassigned

Reporter

Manuel Dominguez Sarmiento

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure