[JAVAEETUTORIAL-107] serializable class does not define serialVersionUID Created: 24/Jun/12  Updated: 05/Feb/13  Resolved: 05/Feb/13

Status: Closed
Project: javaeetutorial
Component/s: doc, examples
Affects Version/s: 6.0.7-5
Fix Version/s: 6.0.7-6, 6.0.8

Type: Improvement Priority: Minor
Reporter: Brant Gurganus Assignee: Kim Haase
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: Not Specified
Original Estimate: 0 minutes


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.

Comment by Ian Evans [ 14/Aug/12 ]

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.

Comment by Kim Haase [ 14/Aug/12 ]


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.

Comment by Kim Haase [ 15/Aug/12 ]

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

Comment by Ian Evans [ 15/Aug/12 ]

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

Comment by Kim Haase [ 16/Aug/12 ]

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

Comment by Kim Haase [ 17/Aug/12 ]

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

Comment by Kim Haase [ 20/Sep/12 ]

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

Comment by Kim Haase [ 20/Sep/12 ]

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

Comment by Kim Haase [ 20/Sep/12 ]

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

Comment by Kim Haase [ 20/Sep/12 ]

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

Comment by Kim Haase [ 20/Sep/12 ]

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

Comment by jendrock [ 05/Feb/13 ]

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.

Generated at Tue Feb 21 03:57:40 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.