persistence@glassfish.java.net

Re: Does "The primary key class must be serializable" mean that "The primary key class must implement java.io.Serializable"?

From: Lance Andersen <Lance.Andersen_at_Sun.COM>
Date: Sat, 26 Apr 2008 16:29:35 -0400

On Apr 26, 2008, at 2:47 AM, Markus KARG wrote:

> "Serializable" and "Externalizable" only are marker interfaces that
> declare that the programmer thinks that his Java Bean is serializable.
Yes i am aware of that.
>
>
> Whether or not it is serializable depends on a lot of other factors,
> like having a public no-arg constructor, marking all non-
> serializable attributes as transient, and so on (= the bean ACTUALLY
> is serializable, independend of the declaration using marker
> interfaces).

Historically when a specification references serializable it is done
so based on the requirements defined in the Serialization spec.
>
>
> Also, if a bean ACTUALLY is serializable, you can serialize it even
> if it is NOT marked as "Serializable" or "Externalizable", using
> java.bean.XMLEncoder. Using XMLEncoder you can serialize an object
> independent of its marker interfaces.

If you are looking for specific specification clarification, then you
need to use the JSR alias for either JSR 220 or JSR 317 using the
alias jsr-220-comments_at_jcp.org or jsr-317-comments_at_jcp.org
>


Rgards
Lance