[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4527) Implements @j.p.Access

Emmanuel Bernard (JIRA) noreply at atlassian.com
Mon Oct 26 11:01:15 EDT 2009


Implements @j.p.Access
----------------------

                 Key: HHH-4527
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4527
             Project: Hibernate Core
          Issue Type: Sub-task
          Components: annotations
            Reporter: Emmanuel Bernard
             Fix For: 3.5


2.3.1, 2.3.2

"the default access type is determined by the placement of mapping annotations on the 
attributes of the entity classes and mapped superclasses of the entity hierarchy that do not explicitly 
specify an access type"

"An access type for an individual entity class, mapped superclass, or embeddable class can be specified 
for that class independent of the default for the entity hierarchy by means of the Access annotation 
applied to the class.  This explicit access type specification does not affect the access type of other entity 
classes or mapped superclasses in the entity hierarchy."

"When Access(FIELD) is applied to such a class, it is possible to 
selectively designate individual attributes within the class for property access.  To specify a 
persistent property for access by the persistence provider runtime, that property must be desig- 
nated Access(PROPERTY) [...] Persistent state inherited from superclasses is accessed in accordance with the access types of 
those superclasses."
"When Access(PROPERTY) is applied to such a class, it is possible to selectively designate indi- 
vidual attributes within the class for instance variable access.  To specify a persistent instance 
variable for access by the persistence provider runtime, that instance variable must be desig- 
nated Access(FIELD). Persistent state inherited from superclasses is accessed in accordance with the access types of 
those superclasses. "

"The access type of an embeddable class is determined by the access type of the entity class, mapped 
superclass, or embeddable class in which it is embedded (including as a member of an element collec- 
tion) independent of whether the access type of the containing class has been explicitly specified or 
defaulted.  A different access type for an embeddable class can be specified for that embeddable class 
by means of the Access annotation "

So in "summary":
 - the default access type of a hierarchy is defined by where annotations are placed (id ideally) on classes that do not override access type
 - the @Access type is not inherited to subclasses (the default access type for the hierarchy is inherited) **
 - the access type of an embeddable or collection of embeddable, if not set explicitly is the one of its containing class (note the logic is different that in a hierarchy)
 - the @Access annotation can be placed on a field to force field access on a class defaulted to property (and vice versa) *

* reverse behavior compared to @o.h.a.AccessType
** I think it's a different behavior than the current @AccessType annotation

If possible, keep support for the legacy @o.h.a.AccessType:
 - it supports alternative access strategies
 - it will keep legacy apps running :)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list