# serialVersionUID + ZK

IngoB
256 6

Hi,

for some of my ZK Controller Classes (... extends GenericForwardComposer<component>) i have to use

private static final long serialVersionUID = XXX;


There are two options, "default" & "generated". I just want to know (if i don't serialize manually and/or have anything to do with it) if the "default / 1L" option is sufficient or do I should use a generated one?

Thanks

delete retag edit

Sort by » oldest newest most voted

IngoB
256 6

Its not about "if" I should use it, it's about if "1L" or "generated" is sufficient.

serialVersionUID is actually the version number of this class his serialisation. You need to change the number when you don't have backwards compability. The serialisation add the serialnumber to the serialised data. While deserialisation it will look at FQN and the serialVersionUID for correctness of the class, if not correct => ClassCastException. This means that 1L is indeed sufficient. If you don't use the Serialisation, it's actually even not needed to set it(But of course it's better to set it).

( 2014-06-30 09:09:53 +0800 )edit

chillworld
5322 4 9
https://github.com/chillw...

Ingo, try to understand the reason of the serialVersionUID and I think you can answer your own question :

[hide preview]