You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-dev@incubator.apache.org by Ruchi Goel <Ru...@Sun.COM> on 2006/10/09 10:10:46 UTC

Error using DefaultCollectionConverter

Hi,
   I  have
 class A {
String path = "/test";
     Collection links =   new ArrayList();

public Collection getLinks()
  return links;
}

public void setLinks(Collection links){
   this.links = links;
}

mapping file as follows:

<graffito-jcr>
<class-descriptor className="com.sun.portal.cms.A" 
jcrNodeType="nt:unstructured" discriminator="false" >
<!-- Field-descriptor is used to map simple attributes to jcr property -->
    <field-descriptor fieldName="path" path="true" />
    <collection-descriptor fieldName="links" jcrName="links" 
elementClassName="java.lang.String" />
                                                                                                                      

</class-descriptor>
</graffito-jcr>


I want  DefaultCollectionConverterImpl to be used when I try 
persistenceManager.insert(a);.
While debugging , I see in DefaultCollectionConverterImpl , the line
 ClassDescriptor elementClassDescriptor = 
mapper.getClassDescriptorByClass( 
ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
returns null

.

However, I do not face any problem if I use collectionConverter : 
MultiValueCollectionConverter..

Is there anything I am missing ?

Help appreciated.
Thanks,
Ruchi

Re: Error using DefaultCollectionConverter

Posted by Alexandru Popescu <th...@gmail.com>.
On 10/9/06, Ruchi Goel <Ru...@sun.com> wrote:
> Hi,
>    I  have
>  class A {
> String path = "/test";
>      Collection links =   new ArrayList();
>
> public Collection getLinks()
>   return links;
> }
>
> public void setLinks(Collection links){
>    this.links = links;
> }
>
> mapping file as follows:
>
> <graffito-jcr>
> <class-descriptor className="com.sun.portal.cms.A"
> jcrNodeType="nt:unstructured" discriminator="false" >
> <!-- Field-descriptor is used to map simple attributes to jcr property -->
>     <field-descriptor fieldName="path" path="true" />
>     <collection-descriptor fieldName="links" jcrName="links"
> elementClassName="java.lang.String" />
>
>
> </class-descriptor>
> </graffito-jcr>
>
>
> I want  DefaultCollectionConverterImpl to be used when I try
> persistenceManager.insert(a);.
> While debugging , I see in DefaultCollectionConverterImpl , the line
>  ClassDescriptor elementClassDescriptor =
> mapper.getClassDescriptorByClass(
> ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
> returns null
>
> .
>
> However, I do not face any problem if I use collectionConverter :
> MultiValueCollectionConverter..
>
> Is there anything I am missing ?
>
> Help appreciated.
> Thanks,
> Ruchi
>

It looks like it is looking for another BeanConverter instead.
Unfortunately, I don't have access to the sourcecode right now to
check what is wrong or if it is supposed to work this way.

./alex
--
.w( the_mindstorm )p.