[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2586) Hibernate Serializable classes do not declare serialVersionUID

Dag Solvoll (JIRA) noreply at atlassian.com
Tue Sep 9 09:06:04 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31113#action_31113 ] 

Dag Solvoll commented on HHH-2586:
----------------------------------

Tried to run the serialver on class org.hibernate.exception.NestableDelegate (hibernate 3.2.5) on different plattforms:

Windows
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-20071007 (JIT enabled)
 static final long serialVersionUID = -6787310117729693199L;

WIndows
SUN Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode)
 static final long serialVersionUID = -6787310117729693199L;

Solaris
SUN Java HotSpot(TM) Server VM (build 1.5.0_11-b03, mixed mode)
static final long serialVersionUID = 1009500911220254726L;

I also see that this particular class has an origin from apache, common-lang, where the serialVersionUID was introduced in version 2.2
(see https://issues.apache.org/jira/browse/LANG-286).



> Hibernate Serializable classes do not declare serialVersionUID
> --------------------------------------------------------------
>
>                 Key: HHH-2586
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2586
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.0 alpha, 3.0 beta 1, 3.0 beta 2, 3.0 beta 3, 3.0 beta 4, 3.0 rc 1, 3.0 final, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1 beta 1, 3.1 beta 2, 3.1 rc 1, 3.1 rc2, 3.1 rc3, 3.1, 3.1.1, 3.1.2, 3.2.0.alpha1, 3.2.0.alpha2, 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3, 3.2.0.cr4, 3.2.0.cr5, 3.2.0.ga, 3.2.1, 3.2.2, 3.2.3
>         Environment: Not specific to any database, platform or Hibernate version.
>            Reporter: Manuel Dominguez Sarmiento
>   Original Estimate: 2 hours
>  Remaining Estimate: 2 hours
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list