Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 47079 invoked from network); 26 Oct 2007 07:39:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2007 07:39:31 -0000 Received: (qmail 22098 invoked by uid 500); 26 Oct 2007 07:39:16 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 22082 invoked by uid 500); 26 Oct 2007 07:39:16 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 22073 invoked by uid 99); 26 Oct 2007 07:39:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 00:39:16 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 07:39:19 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IlJmU-0001E8-Qm for users@jackrabbit.apache.org; Fri, 26 Oct 2007 00:38:58 -0700 Message-ID: <13422253.post@talk.nabble.com> Date: Fri, 26 Oct 2007 00:38:58 -0700 (PDT) From: Kaizer To: users@jackrabbit.apache.org Subject: Re: Using Collections - OCM In-Reply-To: <3b728ee90710252350m2bf031c9t98857192836c2fe1@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: Kaizers@mastek.com References: <13384206.post@talk.nabble.com> <3b728ee90710252350m2bf031c9t98857192836c2fe1@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org 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. > > className="org.apache.jackrabbit.ocm.testmodel.inheritance.impl.FolderImpl" > jcrType="ocm:folderimpl" > > extend="org.apache.jackrabbit.ocm.testmodel.inheritance.impl.CmsObjectImpl" > discriminator="false" > > interfaceName="org.apache.jackrabbit.ocm.testmodel.interfaces.Folder" > /> > autoUpdate="false" > > elementClassName="org.apache.jackrabbit.ocm.testmodel.inheritance.impl.CmsObjectImpl" > > collectionConverter="org.apache.jackrabbit.ocm.manager.collectionconverter.impl.NTCollectionConverterImpl" > /> > > > > 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 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.