jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kaizer <Kaiz...@mastek.com>
Subject Re: Using Collections - OCM
Date Fri, 26 Oct 2007 09:14:20 GMT

I had missed out the "extends" attribute for the derived class. It works fine
on adding it. Also, from where can i get more info on using the
discriminator property?

Thanks!
Kaizer



Christophe Lombart wrote:
> 
> The property discriminator contains the classname. Maybe the some
> collection
> descriptor are not using it correctly.
> If you have no time, I will check this week-end otherwise if you found
> something, you can send us a patch (in jira).
> 
> Thanks,
> Christophe
> 
> On 10/26/07, Kaizer <Kaizers@mastek.com> wrote:
>>
>>
>> Thanks a lot! I am using the discriminator approach. In fact i was
>> thinking
>> of writing my own CollectionConverter wherein I would save the object by
>> taking the class of the item being stored rather than from the
>> "elementClassName" attribute. But the problem would be that while
>> retrieving
>> the object, I wouldnt have the class name to instantiate.
>> Thanks again!
>>
>> Regards
>> Kaizer
>>
>>
>>
>> Christophe Lombart wrote:
>> >
>> > Sorry for the delay I was very busy this week.
>> >
>> > Which inheritance strategy are you using ? Are you using the a
>> > discriminator
>> > or a different node type per Class ?
>> >
>> > There are 2 possibilities :
>> >
>> > 1/ Using a different node type per class in the hierarchy, here is a
>> > example
>> > from the unit test. The implement-descriptor is not mandatory.
>> >
>> > <class-descriptor
>> > className="
>> org.apache.jackrabbit.ocm.testmodel.inheritance.impl.FolderImpl"
>> > jcrType="ocm:folderimpl"
>> >
>> > extend="
>> org.apache.jackrabbit.ocm.testmodel.inheritance.impl.CmsObjectImpl"
>> > discriminator="false"  >
>> >   <implement-descriptor
>> > interfaceName="org.apache.jackrabbit.ocm.testmodel.interfaces.Folder"
>> > />
>> >    <collection-descriptor fieldName="children" proxy="true"
>> > autoUpdate="false"
>> >
>> > elementClassName="
>> org.apache.jackrabbit.ocm.testmodel.inheritance.impl.CmsObjectImpl"
>> >
>> > collectionConverter="
>> org.apache.jackrabbit.ocm.manager.collectionconverter.impl.NTCollectionConverterImpl
>> "
>> > />
>> > </class-descriptor >
>> >
>> >
>> > 2/ Using a discriminator (discriminator =true). It  can be used when
>> you
>> > are
>> > using the same node type for the complete class hierarchy. There is no
>> > unit
>> > tests on collection-descriptor with a discriminator. So, I will write a
>> > new
>> > unit test for this use cases and I will give some feedback. So maybe
>> there
>> > are some bug for this kind of situation.
>> >
>> > Again sorry for the delay.
>> >
>> > br,
>> > Christophe
>> >
>> > On 10/24/07, Kaizer <Kaizers@mastek.com> wrote:
>> >>
>> >>
>> >> Hi,
>> >>
>> >> I have a class A which has a collection of objects of type B. I have
>> made
>> >> the corresponding definitions in the mapping xml. However, If i create
>> a
>> >> class C which extends B and save objects of type C in the list and
>> then
>> >> try
>> >> to retrieve them, I always get an instance of B as the
>> >> ObjectConverterImpl
>> >> always creates a new instance of the "elementClassName" defined in the
>> >> mapping (which would be B in this case). How can i achieve the storage
>> >> and
>> >> retrieval in this scenario?Would I require a custom
>> CollectionConverter?
>> >>
>> >> Thanks.
>> >>
>> >> Regards
>> >> Kaizer
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Using-Collections---OCM-tf4683858.html#a13384206
>> >> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Using-Collections---OCM-tf4683858.html#a13422253
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-Collections---OCM-tf4683858.html#a13423421
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message