Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 62372 invoked from network); 26 Oct 2007 08:03:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2007 08:03:33 -0000 Received: (qmail 70304 invoked by uid 500); 26 Oct 2007 08:03:20 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 70286 invoked by uid 500); 26 Oct 2007 08:03:20 -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 70276 invoked by uid 99); 26 Oct 2007 08:03:19 -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 01:03:19 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of christophe.lombart@gmail.com designates 64.233.162.235 as permitted sender) Received: from [64.233.162.235] (HELO nz-out-0506.google.com) (64.233.162.235) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 08:03:22 +0000 Received: by nz-out-0506.google.com with SMTP id s18so749571nze for ; Fri, 26 Oct 2007 01:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=eLmClFuln1zBo+LFuz5kehQ0aYq07TEmTnG5mMRE0Go=; b=UU6Z8bwJcC9aVSpczvLpmBZ+RPU4o5odivrr9Gxv3nRNfWObtoeXismb2xKC3QzBA9XrAL52CJ+K9JS/4SkiSmtwrLvInXecxvmXvK79XXJb6SUFuU9IgYdykJ212+6wdInGU7fCc1ZocteBiJNhTuEbdeOH6KJ5WiiPESeGe30= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=KXqly1xWJ5ElZQYWCeH0BzrYhxzm4WB9tTcoeDDbhYQhyzUAm6s/BhoMCstfwjGCZy0qnwJTj1jgFvQ0FuWXGjuDl2dGm/Jl572gFsrf42u0u65SJR/yQst6iX7TDKe4J6++JF0aH60plPKv7UijgfL0SXUSlNRNsD8K6RaR6S8= Received: by 10.142.106.18 with SMTP id e18mr782006wfc.1193385781034; Fri, 26 Oct 2007 01:03:01 -0700 (PDT) Received: by 10.142.178.1 with HTTP; Fri, 26 Oct 2007 01:03:00 -0700 (PDT) Message-ID: <3b728ee90710260103u21fafb93w2fe49783f8cc3119@mail.gmail.com> Date: Fri, 26 Oct 2007 10:03:00 +0200 From: "Christophe Lombart" To: users@jackrabbit.apache.org Subject: Re: Using Collections - OCM In-Reply-To: <13422253.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4422_24297800.1193385781003" References: <13384206.post@talk.nabble.com> <3b728ee90710252350m2bf031c9t98857192836c2fe1@mail.gmail.com> <13422253.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_4422_24297800.1193385781003 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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. > > > > > 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. > > ------=_Part_4422_24297800.1193385781003--