Hello again.

Using XmlBeans I've been able to change my array to a MyCustomList<MyClass>,
with MyCustomList extending java.util.AbstractList<MyClass>. I thought this
way it would be easily converted to a ManageableArrayList, but I still get
the same JcrMappingException in
ManageableCollectionUtil.getManageableCollection method. This is the stack
trace:

org.apache.jackrabbit.ocm.exception.JcrMappingException: Unsupported
collection
type : *********** (MyCustomList class)
        at
org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableColle
ctionUtil.getManageableCollection(ManageableCollectionUtil.java:153)
        at
org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverte
rImpl.insertCollectionFields(ObjectConverterImpl.java:780)
        at
org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverte
rImpl.insert(ObjectConverterImpl.java:221)
        at
org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverte
rImpl.insert(ObjectConverterImpl.java:146)
        at
org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.inser
t(ObjectContentManagerImpl.java:407)
Having a look at that method, it seems to not realize my list is a List. Is
it possible that the "if (object.getClass().equals(XXX.class)" clauses
should be "if (object instanceof XXX)" ?  (I have already reassured myself
that MyList instance of List returns true).

Another thing I've seen a bit strange is the call to that method from
ObjectConverterImpl.java:

ManageableCollection manageableCollection =
ManageableCollectionUtil.getManageableCollection(collection);

I don't understand why the ManageableCollectionUtil class is used instead of
the collectionConverter.doGetCollection, since two instructions above we
have obtained the converter from the collectionDescriptor. This would give
users the chance to implement their own doGetCollection in their converter
and have the opportunity to convert the collection to a Manageable one
before calling the ManageableCollectionUtil.getManageableCollection method.

Am I undestanding anything wrong or should the code be as I think?
 
Thank you.
 
Sebastian Gomez.



Christophe Lombart wrote:
> 
> Hi
> 
> until now, Array are not supported. You are welcome to create a jira issue
> and/or provide patches.
> 
> regards,
> Christophe
> 
> 
> On Jan 15, 2008 1:43 PM, sgomez <[EMAIL PROTECTED]> wrote:
> 
>>
>> Hello.
>>
>> I am trying to persist an array of a pre-made class, i.e MyClass[]
>> myArray.
>> I've tried to create a collection converter, but it doesn't seem to work
>> because it tries to cast it to a ManageableCollection before the
>> converter
>> has the chance to convert it into an ArrayList, a Collection, or similar.
>>
>> What is the approach I should take?
>>
>> I'd appreciate a lot your help.
>>
>> Sebastian Gomez.
>> --
>> View this message in context:
>> http://www.nabble.com/ocm%3A-Problems-mapping-an-array-tp14839197p14839197.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ocm%3A-Problems-mapping-an-array-tp14839197p14918583.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Reply via email to