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

Reply via email to