openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <>
Subject Re: Unexpected behaviour for a transient field
Date Mon, 28 Nov 2011 16:54:19 GMT
Harold -

I'm quite surprised that we don't throw an exception, or warning in this
case also. In the case that you mentioned, I assume MyInterface isn't an
Entity type and doesn't extend Serializable?


On Fri, Nov 25, 2011 at 6:00 AM, Harald Wellmann <> wrote:

> In a code review of an application using OpenJPA 2.1.1 with
> persistence mapping by annotations, I've just come across an entity
> class with a non-primitive field which is not annotated:
>   private MyInterface myInterface;
> I would have put a @Transient annotation on that field (or better
> still, removed it from the model), but what surprises me is that
> OpenJPA silently treats this field as transient and does not complain
> about a missing @Transient annotation.
> We use build time enhancement, and I can see no warnings from OpenJPA
> either at build time or at run-time.
> According to the JPA 2.0 spec, section 2.3.1, "all non-transient
> instance variables that are not annotated with the Transient
> annotation are persistent.", so I'd really expect OpenJPA to complain
> that MyInterface is not mapped.
> What do you think?
> Best regards,
> Harald

*Rick Curtis*

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message