You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Harald Wellmann (Created) (JIRA)" <ji...@apache.org> on 2011/11/29 20:27:40 UTC

[jira] [Created] (OPENJPA-2083) Unmapped fields silently treated as transient

Unmapped fields silently treated as transient
---------------------------------------------

                 Key: OPENJPA-2083
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2083
             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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2083) Unmapped fields silently treated as transient

Posted by "Kevin Sutter (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13159685#comment-13159685 ] 

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: https://issues.apache.org/jira/browse/OPENJPA-2083
>             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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2083) Unmapped fields silently treated as transient

Posted by "Rick Curtis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13161109#comment-13161109 ] 

Rick Curtis commented on OPENJPA-2083:
--------------------------------------

Kevin / Harold -

Thoughts on the correct 'fix' for this issue? I'm leaning toward a warning message...

Thanks,
Rick
                
> Unmapped fields silently treated as transient
> ---------------------------------------------
>
>                 Key: OPENJPA-2083
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2083
>             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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2083) Unmapped fields silently treated as transient

Posted by "Kevin Sutter (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13161704#comment-13161704 ] 

Kevin Sutter commented on OPENJPA-2083:
---------------------------------------

I think a warning message would be an excellent first step.  At least it would highlight to users that OpenJPA may not be doing the processing that you are expecting (or vice versa).  This could still potentially be raised as a spec violation, but that's splitting hairs in my opinion.  So, let's highlight the processing with a warning message and say we're done.
                
> Unmapped fields silently treated as transient
> ---------------------------------------------
>
>                 Key: OPENJPA-2083
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2083
>             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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (OPENJPA-2083) Unmapped fields silently treated as transient

Posted by "Donald Woods (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods reassigned OPENJPA-2083:
-------------------------------------

    Assignee: Donald Woods
    
> Unmapped fields silently treated as transient
> ---------------------------------------------
>
>                 Key: OPENJPA-2083
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2083
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.1
>            Reporter: Harald Wellmann
>            Assignee: Donald Woods
>            Priority: Minor
>         Attachments: OPENJPA-2083.patch
>
>
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2083) Unmapped fields silently treated as transient

Posted by "Jacob Nowosatka (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacob Nowosatka updated OPENJPA-2083:
-------------------------------------

    Attachment: OPENJPA-2083.patch

Patch adds a warning message when dealing with unmapped non-primitive fields stating that "the fields are not default persistent and do not have any annotations. and will be treated as non-persistent. If they fields should be persistent, annotate them with the appropriately. Otherwise, mark them as transient."
                
> Unmapped fields silently treated as transient
> ---------------------------------------------
>
>                 Key: OPENJPA-2083
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2083
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.1
>            Reporter: Harald Wellmann
>            Priority: Minor
>         Attachments: OPENJPA-2083.patch
>
>
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2083) Unmapped fields silently treated as transient

Posted by "Donald Woods (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-2083:
----------------------------------

       Patch Info: Patch Available
    Fix Version/s: 2.2.0
    
> Unmapped fields silently treated as transient
> ---------------------------------------------
>
>                 Key: OPENJPA-2083
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2083
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.1
>            Reporter: Harald Wellmann
>            Assignee: Donald Woods
>            Priority: Minor
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2083.patch
>
>
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENJPA-2083) Unmapped fields silently treated as transient

Posted by "Donald Woods (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods resolved OPENJPA-2083.
-----------------------------------

    Resolution: Fixed

Committed revision 1226910.
                
> Unmapped fields silently treated as transient
> ---------------------------------------------
>
>                 Key: OPENJPA-2083
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2083
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.1
>            Reporter: Harald Wellmann
>            Assignee: Donald Woods
>            Priority: Minor
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2083.patch
>
>
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (OPENJPA-2083) Unmapped fields silently treated as transient

Posted by "Albert Lee (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee closed OPENJPA-2083.
-------------------------------


Close issue in preparation for 2.2.0 release.
                
> Unmapped fields silently treated as transient
> ---------------------------------------------
>
>                 Key: OPENJPA-2083
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2083
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.1
>            Reporter: Harald Wellmann
>            Assignee: Donald Woods
>            Priority: Minor
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2083.patch
>
>
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira