This is a pretty complex issue, and I think out of the scope of
Cayenne. In general, you don't need a serialVersionUID.. however if
you don't have one, it will change every time the class is recompiled
(and further change between certain JVMs, but that's another issue).
If you serialize a class, and want to read it back later, "later", the
serialVersionUIDs must match.
If you are deploying to Tomcat, you can see this flash by sometimes
when it serialized the sessions out to disk and then couldn't restore
some classes because the UIDs changed. In general, I would suggest not
using the ones Eclipse provides unless you know what you're doing.
Setting a serialVersionUID explicitly says that you want to be
responsible for version control and managing deserializing one version
of a class into another. If you don't need/want that, let it be the
default, so that if you accidentally try to, you get immediate
feedback via an exception :)
Cris
On 2/13/06, Jeff de Vries <jdevrie..frog.com> wrote:
> We recently moved to Eclipse 3.1 from Eclipse 3.0, and now we get lots
> of warnings along the lines of "class <foo> does not have a final,
> static serialVersionUID". Apparently, this is something Java
> Serializable needs. Fortunately, Eclipse has a fast way of setting
> these (double-click on warning, then Ctrl-1 to have a serialVersionUID
> generated and inserted for you).
>
> My question has to do with Cayenne's auto-generated classes. Is there a
> way to have serialVersionUID's automatically generated and inserted into
> the auto classes? If not, how are other people handling this issue?
>
> Thanks,
> Jeff de Vries
>
>
This archive was generated by hypermail 2.0.0 : Mon Feb 13 2006 - 19:32:08 EST