[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-964) add serialVersionUID to entity classes

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Thu Oct 23 03:10:05 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31509#action_31509 ] 

Max Rydahl Andersen commented on HBX-964:
-----------------------------------------

@jahlobrn: the difference is that without putting the serialversionuid the code matches the excpected behavior (no guarantee); put serialversionuid and you stop Eclipses stupid warning from happening and you now just have to wait for the seriliazation error to happen in mysterious ways.

I know it is not perfect; just stating that I think its wrong ;)

With respect to meta attribute then I was more thinking of having a flag like "ejb3" or "java5" as we have today, but since this will add too much configuration I'm fine with enabling generation of serialVersionUID (iif calculated based on signature and iif the class implement serializable) 

> add serialVersionUID to entity classes
> --------------------------------------
>
>                 Key: HBX-964
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-964
>             Project: Hibernate Tools
>          Issue Type: Improvement
>          Components: hbm2java
>    Affects Versions: 3.2beta10
>            Reporter: Dan Allen
>            Priority: Minor
>         Attachments: HBX-964-v1.txt
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> The serialVersionUID is recommended for classes that implement java.io.Serializable.  The hbm2java task should either set the serialVersionUID to 1L or automatically generate a value. I prefer setting it to 1L because it is easy and it will work, but if you feel motivated, you can look at what Eclipse does to generate this value from the class signature.
> I have included a patch that just sets it to 1L.

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