How to generate serialVersionUID for Serializable?
12,680
If you have a class which implements Serializable
interface but doesn't specify a serialVersionUID
, you'll get a warning. You can automatically ask Eclipse to fix that warning by clicking on the balloon which pops up on that line. Make sure you don't generate a random but a logical serialVersionUID
i.e. 0
or 1
if this is the first draft of your serilizable class.
Related videos on Youtube
Comments
-
Adi Mor almost 2 years
I have a class A that extends another class B that implements
Serializable
interface. I want to automatically generate theserialVersionUID
for class A using the Eclipse.If class A was the class that implements
Serializable
Eclipse will have a error compilation. Please help me generate it automatically.class A
public class QueryOptionModel extends BaseModelData { }
public class BaseModelData implements ModelData, Serializable
-
home about 12 yearsPlease provide some further details - which error do you receive?
-
Adi Mor about 12 yearsi don't receive that's the prob
-
tartak about 12 yearsWhen your class's parent class extends a serializable class, |Eclipse asks you (warning) to provide a serialVersionUID. I don't get your problem
-
Adi Mor about 12 yearsthe problem is that eclipse didn't ask me to provide a serialVersionUID
-
-
Adi Mor about 12 yearsbut my class extent a class that implement a the Serializable, and don't show the warning
-
Sanjay T. Sharma about 12 yearsI think you should post the code you are using. I do get a warning on my stock Eclipse installation.
-
Uli about 8 yearsProbably your compiler settings ignore this. You can change this in Eclipse: Open the properties of your project, select Java Compiler => Errors/Warnings and set the item Serializable class without serialVersionUID to Warning or Error.