openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter (Commented) (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2083) Unmapped fields silently treated as transient
Date Wed, 30 Nov 2011 00:17:39 GMT


Kevin Sutter commented on OPENJPA-2083:

FYI, the OpenJPA manual documents slightly different behavior:

"2.14.  Persistent Field Defaults

In the absence of any of the annotations above, JPA defines the following default behavior
for declared fields:

 o   Fields declared static, transient, or final default to non-persistent.

 o   Fields of any primitive type, primitive wrapper type, java.lang.String, byte[], Byte[],
char[], Character[], java.math.BigDecimal, java.math.BigInteger, java.util.Date, java.util.Calendar,
java.sql.Date, java.sql.Timestamp, or any Serializable type default to persistent, as if annotated
with @Basic.

 o   Fields of an embeddable type default to persistent, as if annotated with @Embedded.

 o   All other fields default to non-persistent. 

Note that according to these defaults, all relations between entities must be annotated explicitly.
Without an annotation, a relation field will default to serialized storage if the related
entity type is serializable, or will default to being non-persistent if not."

At least this explains the OpenJPA behavior.  But, now we have to resolve this behavior against
the JPA spec-defined behavior...
> Unmapped fields silently treated as transient
> ---------------------------------------------
>                 Key: OPENJPA-2083
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.1
>            Reporter: Harald Wellmann
>            Priority: Minor
> The JPA 2.0 spec requires any non-static non-transient entity field to be persistent
unless explicitly mapped as transient by a @Transient annotation or the equivalent XML.
> OpenJPA 2.1.1 silently treats some unmapped non-primitive fields as transient instead
of throwing an exception or at least logging a warning.
> Example:
> @Entity
> public class City {
>     @Id
>     private String name;
>     private Integer population;
>     private java.util.concurrent.Executor executor;
>     // getters and setters
> }

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message