With this sort of support and activity OCM is going places !!..thank you very much. I will look at the code later in the day and will update you either with good news that it works or with testcase/patch.
-----Original Message----- From: Christophe Lombart [mailto:[EMAIL PROTECTED] Sent: 24 September 2008 14:19 To: [email protected] Subject: Re: OCM:Collection Element Node Names The class DigesterDescriptorReader reads the XML mapping file. For each persistent class, the reader will create a ClassDescriptor (see the pck org.apache.jackrabbit.ocm.mapper.model). For each classdescriptor, it will create FieldDescriptors, BeanDescriptors and CollectionDescriptors depending on the stucture of the persistent class. All those persistent meta info will be used by the ObjectContentManager. By using the different descriptors, it knows how to persist the java objects. Following your problem, maybe just add the attribute jcrElementName in your collection-descriptor. I think it should be ok but I have to review the code of DigesterDescriptorReader in more details. A unit test is missing for that. If you can provide this unit test, I will be very happy :-) eg. : <collection-descriptor fieldName="emptyCollection" jcrName="emptyCollection" proxy="false" jcrElementName="myname" elementClassName="org.apache.jackrabbit.ocm.testmodel.C" /> Then, "myname" will be used as node name for all elements in the collection (in place of collection-element). If you need a different name for each element in the collection. You have to specify an id field in the Class Descriptor used for the collection elements (see the javadoc for DefaultCollectionConverterImpl & NTCollectionConverterImpl). eg. <class-descriptor className="Foo" jcrType="nt:unstructured"> <field-descriptor fieldName="name" jcrName="name" id =true/> </class-descriptor> if you are using the class Foo in a CollectionDescriptor, the value of the field called "name" will be used for the each node inside the collection. That's the default behaviour provided by the 2 main collection converters : DefaultCollectionConverterImpl & NTCollectionConverterImpl. Let me know if you need more information or if you have another idea to solve the problem. Thanks Christophe On Wed, Sep 24, 2008 at 09:41, Boni Gopalan (BioImagene) < [EMAIL PROTECTED]> wrote: > I need to have this feature through XML mapping file. If you can > outline the approach I could fix and provide a patch. > > -----Original Message----- > From: Christophe Lombart [mailto:[EMAIL PROTECTED] > Sent: 24 September 2008 10:57 > To: [email protected] > Subject: Re: OCM:Collection Element Node Names > > This is not yet possible with the XML file mapping. > With tha OCM annotation, you can use jcrElementName on @Collection. It > should not be difficult to add it in the XML mapping file definition. > > Christophe > > > On Wed, Sep 24, 2008 at 06:31, Boni Gopalan (BioImagene) < > [EMAIL PROTECTED]> wrote: > > > I have a Bean in the following structure : > > > > > > > > Class Bar{ > > > > List<Foo> fooList; > > > > } > > > > > > > > Class Foo{ > > > > String name; > > > > } > > > > > > > > This structure is mapped with the following mapping file : > > > > > > > > <class-descriptor className="Bar" > > > > jcrType="nt:unstructured"> > > > > <collection-descriptor fieldName="fooList" > jcrName="fooList" > > proxy="false" > > > > elementClassName="Foo" jcrSameNameSiblings="false"/> > > > > </class-descriptor> > > > > > > > > <class-descriptor className="Foo" > > > > jcrType="nt:unstructured"> > > > > <field-descriptor fieldName="name" > > jcrName="name"/> > > > > </class-descriptor> > > > > > > > > When the data is saved the ensueing node structure is like : > > > > > > > > Bar > > > > |___fooList > > > > |___collection-element > > > > |___collection-element > > > > > > > > > > > > My Question is how can I specify a particular node name for > > 'collection-element' ? Is there an attribute in the mapping file > > (possibly for collection-descriptor) to specify the name of each > > element? > > > > > > > > Thanks > > > > > > > > Boni Gopalan > > Manager Engineering > > BioImagene, Pune > > > > +91-206-609-6579(O) > > +91-992-369-9356(C) > > > > > > > > >
