http://opensource.atlassian.com/projects/hibernate/browse/HHH-6246
by working on mocking orm xml into jpa annotations, i found the most
complicated logic is how to determine access (where mocked annotations, i.e.
@Column, go, on property or on field) for an attribute.
by reading jpa spec, i'd think here are the rules of finding default access
type for attributes: (correct me if i'm wrong, thanks)
A. get it from attribute directly
1. if the attribute xml element in orm xml has an access property
2. if the attribute has a @Access on its field ( @Access(FIELD) ) or property(
@Access(PROPERTY) )
B. get it from Entity (MappedSuperClass, Embeddable)
1. if <entity> has "access"
2. if entity class has @Access
loop: 1,2 with entity's parent
3. if <access> is defined in <persistence-unit-metadata>
C. get it from id attribute
1. if <id> is defined in orm xml and has access attribute
2. if id attribute in entity class has @Id with @Access
3. get the @Id position
loop: 1,2,3 with entity's parent class
D. access= PROPERTY
but wrt default access which defined in <persistence-unit-metadata>, the JPA
spec says
{quote}
The access subelement is overridden by the use of any annotations specifying
mapping information on the fields or properties of the entity class; by any
Access annotation on the entity class, mapped superclass, or embeddable class;
by any access subelement of the entity-mappings element; by any Access
annotation on a field or property of an entity class, mapped superclass, or
embeddable class; by any access attribute defined within an entity,
mapped-superclass, or embeddable XML element, or by any access attribute
defined within an id, embedded-id, version, basic, embedded, many-to-one,
one-to-one, one-to-many, many-to-many, or element-collection element.
{quote}
which "The access subelement is overridden by the use of any annotations
specifying mapping information on the fields or properties of the entity class"
really confuses Hardy and me.
from our "old" binding code, if defauls access is FIELD, and an entity does not
have any @Access nor access in orm, hibernate just ignore all annotations on
PROPERTY.
it seems confilcts with above statement from spec...
-----------
Strong Liu <[email protected]>
http://hibernate.org
http://github.com/stliu
_______________________________________________
hibernate-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/hibernate-dev