jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Moved: (OCM-8) Cannot use @Collection on getters
Date Mon, 27 Apr 2009 15:02:34 GMT

     [ https://issues.apache.org/jira/browse/OCM-8?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jukka Zitting moved JCR-1928 to OCM-8:
--------------------------------------

          Component/s:     (was: jackrabbit-ocm)
    Affects Version/s:     (was: 1.5.0)
             Workflow: no-reopen-closed, patch-avail  (was: jira)
                  Key: OCM-8  (was: JCR-1928)
              Project: Jackrabbit OCM  (was: Jackrabbit Content Repository)

> Cannot use @Collection on getters
> ---------------------------------
>
>                 Key: OCM-8
>                 URL: https://issues.apache.org/jira/browse/OCM-8
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>            Reporter: Yoav Landman
>
> I have a class with no mapped fields that has a collection reference. With JR 1.4.x,
I use to use a collection mapping like this on the getter:
> @Node(extend = OcmStorable.class)
> public class User implements OcmStorable {
> @Collection(elementClassName = String.class, collectionConverter = MultiValueCollectionConverterImpl.class)
>     public Set<String> getGroups() {
>         return info.getGroups();
>     }
>     public void setGroups(Set<String> groups) {
>         info.setGroups(groups);
>     }
> }
> With 1.5 this crashes with:
> Caused by: org.apache.jackrabbit.ocm.exception.InitMapperException: Impossible to read
the mapping descriptor from the getter for class : class org.artifactory.security.User for
field : groups; nested exception is java.lang.NoSuchFieldException: groups
> 	at org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationDescriptorReader.addDescriptorsFromGetters(AnnotationDescriptorReader.java:221)
[jackrabbit-ocm-1.5.0.jar:na]
> 	at org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationDescriptorReader.addAttributeDescriptors(AnnotationDescriptorReader.java:159)
[jackrabbit-ocm-1.5.0.jar:na]
> 	at org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationDescriptorReader.buildClassDescriptor(AnnotationDescriptorReader.java:80)
[jackrabbit-ocm-1.5.0.jar:na]
> 	at org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationDescriptorReader.loadClassDescriptors(AnnotationDescriptorReader.java:64)
[jackrabbit-ocm-1.5.0.jar:na]
> 	at org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl.buildMapper(AbstractMapperImpl.java:60)
[jackrabbit-ocm-1.5.0.jar:na]
> 	at org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationMapperImpl.<init>(AnnotationMapperImpl.java:37)
[jackrabbit-ocm-1.5.0.jar:na]
> 	at org.artifactory.jcr.InitJcrRepoStrategy.initializeOcm(InitJcrRepoStrategy.java:119)
[classes/:na]
> 	at org.artifactory.jcr.InitJcrRepoStrategy.init(InitJcrRepoStrategy.java:97) [classes/:na]
> 	... 31 common frames omitted
> Caused by: java.lang.NoSuchFieldException: groups
> 	at java.lang.Class.getDeclaredField(Class.java:1854) [na:1.5.0_16]
> 	at org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationDescriptorReader.addDescriptorsFromGetters(AnnotationDescriptorReader.java:215)
[jackrabbit-ocm-1.5.0.jar:na]
> 	... 38 common frames omitted
> Looks like org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationDescriptorReader#216
is passing: propertyDescriptor.getPropertyType().getDeclaredField(propertyDescriptor.getName()),
> and propertyDescriptor.getPropertyType() is, in fact, java.util.Set (so of course no
'groups' field).
> As a workaround, I have to use a dummy field, annotate it and let the getters and setters
work as before.
> Thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message