I've noticed in some cases I can have relationships that are interfaces, while in others SDG doesn't seem to be able to determine the FieldAccessor unless I use the implementation. Here's an example:
produces the following warning related to the 'user' property...Code:@NodeEntity public class AclEntryImpl implements AclEntry { @RelatedTo(type = "ACLENTRY_PRINCIPAL", elementClass = PrincipalImpl.class) private Principal user; @RelatedTo(type = "PERMISSION", elementClass = PermissionImpl.class) private Set<Permission> permissionSet = new HashSet<Permission>(10, 10); private boolean negative = false; }
But the 'permissionSet' property is set correctly, even through it is using the Permission interface, not the PermissionImpl...Code:Apr 21, 2011 8:01:25 AM org.springframework.data.graph.neo4j.fieldaccess.DelegatingFieldAccessorFactory factoryForField WARNING: No FieldAccessor configured for field: private java.security.Principal org.mycompany.graph.model.acl.AclEntryImpl.user
When I change the 'user' property to the implementation of Principal, no more warnings:Code:Apr 21, 2011 8:01:25 AM org.springframework.data.graph.neo4j.fieldaccess.DelegatingFieldAccessorFactory factoryForField INFO: Factory org.springframework.data.graph.neo4j.fieldaccess.OneToNRelationshipFieldAccessorFactory@15d616e used for field: private java.util.Set org.mycompany.graph.model.acl.AclEntryImpl.permissionSet
no more warnings...Code:@NodeEntity public class AclEntryImpl implements AclEntry { @RelatedTo(type = "ACLENTRY_PRINCIPAL", elementClass = PrincipalImpl.class) private PrincipalImpl user; @RelatedTo(type = "PERMISSION", elementClass = PermissionImpl.class) private Set<Permission> permissionSet = new HashSet<Permission>(10, 10); private boolean negative = false; }
Code:Apr 21, 2011 8:07:37 AM org.springframework.data.graph.neo4j.fieldaccess.DelegatingFieldAccessorFactory factoryForField INFO: Factory org.springframework.data.graph.neo4j.fieldaccess.SingleRelationshipFieldAccessorFactory@1cfb802 used for field: private org.mycompany.graph.model.acl.PrincipalImpl org.mycompany.graph.model.acl.AclEntryImpl.user
Why can't I use the Principal interface for this property? I would think the 'elementClass = PrincipalImpl.class' directive should give SDG enough info to work with.


Reply With Quote