users@glassfish.java.net

RE: RE: Re: Persistence, ignoring a class field

From: roger.keays <roger.keays_at_ninthavenue.com.au>
Date: Tue, 9 Jan 2007 16:13:51 -0800 (PST)

Jason Lee-3 wrote:
>
>> Do you mean WRT serialization or persistence? With
>> field-based access neither should be persisted surely? That's
>> always been my understanding and also how I'd interpret the
>> paragraph from the spec that Kenneth posted.
>
> We were trying to avoid persisting a field in a JPA entity bean and
> couldn't figure why it wasn't working. We finally realized we had
> "transient", which affects serialization, and not "@Transient" which
> affects JPA persistence...
>

Then I would say that's a bug in your JPA implementation. To requote from
the spec (section 2.1.1):

"All non-transient instance variables that are not annotated with the
Transient annotation are persistent."

which would imply that all *transient* instance variables should not be
persisted. The java spec doesn't specifically define transient as applying
only to serialization either:
http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.3.1.3

Roger

-- 
View this message in context: http://www.nabble.com/Persistence%2C-ignoring-a-class-field-tf2940151.html#a8249718
Sent from the java.net - glassfish users mailing list archive at Nabble.com.