openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-1977) Final methods are not supported but documentation sais they are
Date Tue, 12 Apr 2011 14:59:05 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13018852#comment-13018852
] 

Rick Curtis commented on OPENJPA-1977:
--------------------------------------

I've been doing some research this morning and it seems that our docs, code, and the spec
are a bit in contradiction. In the cases I tested, the code seems to ignore any annotations
on methods that are marked as final. The spec states "The entity class must not be final.
No methods or persistent instance variables of the entity class may be final". Our docs[1]
state that if an annotation isn't present, a final field will be treated as transient.

I can certainly see the case where I'd want to mark methods on a super class final so that
subclasses can't override certain methods. Unfortunately that design goes against the spec
(I presume due to subclassing JPA providers) and we don't currently support the behavior.
I could be swayed, but I'm thinking that I'm going to update the docs to accurately reflect
what the code really does and add a new warning message for when we detect this condition.

Thoughts?

[1] 2.15.  Persistent Field Defaults
In the absence of any of the annotations above, JPA defines the following default behavior
for declared fields:
   1.  Fields declared static, transient, or final default to non-persistent. 

> Final methods are not supported but documentation sais they are
> ---------------------------------------------------------------
>
>                 Key: OPENJPA-1977
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1977
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.0
>            Reporter: Heinz Striebeck
>            Assignee: Rick Curtis
>            Priority: Minor
>
> See http://openjpa.208410.n2.nabble.com/Issues-with-GeneratedValue-and-SequenceGenerator-td6244055.html
> When using final methods for the id field, the generated id is unavailable for the application.
> According to the mailing list, final methods are not supported, but the OpenJPA documentation
sais so:
> http://openjpa.apache.org/builds/2.1.0/apache-openjpa-2.1.0/docs/manual/jpa_overview_pc.html#jpa_overview_pc_final
> So at least the documentation should be changed.
> An error message at runtime would also be fine - that would be also related to
> https://issues.apache.org/jira/browse/OPENJPA-465

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message