persistence@glassfish.java.net

Re: Serializable Entities

From: Stephen Connolly <stephen.alan.connolly_at_gmail.com>
Date: Wed, 21 Nov 2007 20:05:04 +0000

instance variables marked transient will neither be serialized nor
persisted by JPA.
what are you keeping in these transient fields that cannot be derived
from the non-transient fields?


On 11/21/07, Shelley <randomshelley_at_gmail.com> wrote:
> What are the best practices for serializing entities? My entities use
> field-based access, so custom serialization will not work because this
> requires that the instance variables are declared 'transient' (which
> indicates to the persistence provider that such fields are not to be
> persisted). Is default serialization generally a recommended practice
> for entities, or will I need to refactor my entity classes for
> property-based access in order to customize the serialization?
>