javaeetutorial
  1. javaeetutorial
  2. JAVAEETUTORIAL-107

serializable class does not define serialVersionUID

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 6.0.7-5
    • Fix Version/s: 6.0.7-6, 6.0.8
    • Component/s: doc, examples
    • Labels:
      None

      Description

      The managed bean described at http://docs.oracle.com/javaee/6/tutorial/doc/gipob.html is marked as Serializable but does not define a serialVersionUID. While not technically necessary, I believe it is best practice to define it since different JVMs will generate different default serialVersionUIDs so retroactively setting a compatible serialVersionUID may not be easy.

        Activity

        Hide
        Ian Evans added a comment -

        There also is the issue that NetBeans adds serialVersionUID as an editor hint, but defaults the value to 1L for every class. So, we need to sweep through our sources to make sure that we have unique IDs for our serializable classes.

        Show
        Ian Evans added a comment - There also is the issue that NetBeans adds serialVersionUID as an editor hint, but defaults the value to 1L for every class. So, we need to sweep through our sources to make sure that we have unique IDs for our serializable classes.
        Hide
        Kim Haase added a comment -

        Yes.

        A few other chapters in the book contain code with the 1L assignment. I am fixing the CDI one. It occurs in a couple of persistence chapters also.

        Show
        Kim Haase added a comment - Yes. A few other chapters in the book contain code with the 1L assignment. I am fixing the CDI one. It occurs in a couple of persistence chapters also.
        Hide
        Kim Haase added a comment -

        Checked in code and book fixes for web/guessnumber and cdi/guessnumber examples.

        Show
        Kim Haase added a comment - Checked in code and book fixes for web/guessnumber and cdi/guessnumber examples.
        Hide
        Ian Evans added a comment -

        Revision: 984
        Author: ievans
        Date: 2012-08-15 09:47
        Message: Replaced all serialVersionUID fields with unique values; general code cleanup (added @Override annotation, StringBuilder, improved logging syntax, etc.)
        Issue #JAVAEETUTORIAL-107 - serializable class does not define serialVersionUID

        Show
        Ian Evans added a comment - Revision: 984 Author: ievans Date: 2012-08-15 09:47 Message: Replaced all serialVersionUID fields with unique values; general code cleanup (added @Override annotation, StringBuilder, improved logging syntax, etc.) Issue # JAVAEETUTORIAL-107 - serializable class does not define serialVersionUID
        Hide
        Kim Haase added a comment -

        Checked in code fixes for mailconnector example (revisions 988 and 989).

        Show
        Kim Haase added a comment - Checked in code fixes for mailconnector example (revisions 988 and 989).
        Hide
        Kim Haase added a comment -

        Committed more bookstore example classes that needed a serialVersionUID, at revision 992.

        Show
        Kim Haase added a comment - Committed more bookstore example classes that needed a serialVersionUID, at revision 992.
        Hide
        Kim Haase added a comment -

        Committed cleaned-up code in cdi/decorators, including serialVersionUID, at revision 996.

        Show
        Kim Haase added a comment - Committed cleaned-up code in cdi/decorators, including serialVersionUID, at revision 996.
        Hide
        Kim Haase added a comment -

        Committed cleaned-up code in cdi/billpayment, including serialVersionUID, at revision 997.

        Show
        Kim Haase added a comment - Committed cleaned-up code in cdi/billpayment, including serialVersionUID, at revision 997.
        Hide
        Kim Haase added a comment - - edited

        Committed cleaned-up code in cdi/producerfields, including serialVersionUID, at revisions 998 and 1001.

        Show
        Kim Haase added a comment - - edited Committed cleaned-up code in cdi/producerfields, including serialVersionUID, at revisions 998 and 1001.
        Hide
        Kim Haase added a comment -

        Committed cleaned-up code in jms/clientmdbentity, including serialVersionUID, at revision 1000.

        Show
        Kim Haase added a comment - Committed cleaned-up code in jms/clientmdbentity, including serialVersionUID, at revision 1000.
        Hide
        Kim Haase added a comment -

        Committed cleaned-up code in Duke's Forest projects, including serialVersionUID, at revision 1002.

        Show
        Kim Haase added a comment - Committed cleaned-up code in Duke's Forest projects, including serialVersionUID, at revision 1002.
        Hide
        jendrock added a comment -

        This issue has been fixed. Depending to whom you talk, this issue is either trivial or irrelevant. The 1L value, generated and inserted by the IDE is sufficient for the examples. In a real world production environment, a unique, generated UID would be a necessity, but not here. The change has been made to all or almost all of the examples already. Enough has been done to close the issue.

        Show
        jendrock added a comment - This issue has been fixed. Depending to whom you talk, this issue is either trivial or irrelevant. The 1L value, generated and inserted by the IDE is sufficient for the examples. In a real world production environment, a unique, generated UID would be a necessity, but not here. The change has been made to all or almost all of the examples already. Enough has been done to close the issue.

          People

          • Assignee:
            Kim Haase
            Reporter:
            Brant Gurganus
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: