[forge-dev] Create serialVersionUID field on mapped @Entity classes, yes / no?

Pete Muir pmuir at redhat.com
Tue Mar 6 04:30:09 EST 2012


Maybe I said it. It's not good practice to put serialVersionUID=1L, as it's broken in reality (all versions are now the same version). If you omit it entirely, then the JVM will compute the serialVersionUID for you on the fly, from the class file. This is much better for development. Once your app has stabilised, you can then go through and generate the ids needed. Instead of adding the serialVersionUID, I would suggest adding the relevant @SuppressWarnings("serial") (IIRC, that is the one).

On 2 Mar 2012, at 13:34, Lincoln Baxter, III wrote:

> Pete. Was you you who suggested that we remove serialUID on entities? because serialuid=1L; is technically invalid in a real environment.
> 
> Does anyone remember why we removed this feature again?
> 
> ~Lincoln
> 
> ---------- Forwarded message ----------
> From: George Gastaldi (JIRA) <jira-events at lists.jboss.org>
> Date: Thu, Mar 1, 2012 at 12:41 PM
> Subject: [forge-issues] [JBoss JIRA] (FORGE-157) Create serialVersionUID field on mapped classes
> To: forge-issues at lists.jboss.org
> 
> 
> 
>     [ https://issues.jboss.org/browse/FORGE-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> 
> George Gastaldi updated FORGE-157:
> ----------------------------------
> 
>              Status: Pull Request Sent  (was: Reopened)
>    Git Pull Request: https://github.com/forge/core/pull/120
> 
> 
> Test case and fix included ;)
> 
> > Create serialVersionUID field on mapped classes
> > -----------------------------------------------
> >
> >                 Key: FORGE-157
> >                 URL: https://issues.jboss.org/browse/FORGE-157
> >             Project: Forge
> >          Issue Type: Enhancement
> >          Components: Builtin Plugins
> >    Affects Versions: 1.0.0.Beta1
> >            Reporter: George Gastaldi
> >             Fix For: 1.0.0.Beta2
> >
> >
> > When creating a new entity, the class implements Serializable however does not specify a serialVersionUID field.
> 
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
> For more information on JIRA, see: http://www.atlassian.com/software/jira
> 
> 
> _______________________________________________
> forge-issues mailing list
> forge-issues at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-issues
> 
> 
> 
> -- 
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"




More information about the forge-dev mailing list