You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Gonzalo Aguilar Delgado <ga...@aguilardelgado.com> on 2010/07/16 13:23:27 UTC

Collections: How to use? Waht's the collection converter?

Hi all!

I'm trying to understand the correct use of collections mapping of the
jackrabbit OCM.

	@Collection(proxy=true, 
			  elementClassName=SomeClass.class,
collectionConverter=NTCollectionConverterImpl.class)

I found something like this but I really don't understand what's going
on with this.

Is there any good explanation about how to use? The main page is almost
empty...

Thank you.







____________________________________




  Gonzalo Aguilar Delgado
  Consultor CRM - Ingeniero en
Informática
        M. +34 607814276











Re: Collections: How to use? What's the collection converter?

Posted by Gonzalo Aguilar Delgado <ga...@aguilardelgado.com>.
Hi Again, 

I want to be more specific. I was looking at the example found in:
http://jackrabbit.apache.org/mapping-stategies.html
http://jackrabbit.apache.org/mapping-collection-fields.html


But, That's not what I want. It seems that collections here are used to
map childen nodes. This example is also incomplete because we cannot see
how to build the class to support this feature.

In my case I just want to have a collection of item,value filled in and
stored in the repository.

I created something like:
	@Collection(proxy=false, jcrName="j2:decorators", 
			  elementClassName=String.class)
	protected HashMap<String, String> decorators = new HashMap<String,
String>();


With properties created as:

	public HashMap<String, String> getDecorators() {
		return decorators;
	}

	public void setDecorators(HashMap<String, String> decorators) {
		this.decorators = decorators;
	}

My nodetype definition is as follows:


	<nodeType name="j2:jetspeedskinnabledecorableimpl" isMixin="false"
		hasOrderableChildNodes="false" primaryItemName="">
		<supertypes>
			<supertype>j2:jetspeedhierarchyimpl</supertype>
		</supertypes>
		<propertyDefinition name="j2:skin" requiredType="String"
			autoCreated="false" mandatory="false" onParentVersion="COPY"
			protected="false" multiple="false">
			<defaultValues>
				<defaultValue></defaultValue>
			</defaultValues>
		</propertyDefinition>
		
		<propertyDefinition name="j2:decorators" requiredType="String"
			autoCreated="false" mandatory="false" onParentVersion="COPY"
			protected="false" multiple="false">
			<defaultValues>
				<defaultValue></defaultValue>
			</defaultValues>
		</propertyDefinition>
	</nodeType>


But for me this does not work. Says that class String is not mapped. It
shouldn't.

So I'm sure that I'm not handling this properly. 

How can I do what I want?

Thank you.



El vie, 16-07-2010 a las 13:23 +0200, Gonzalo Aguilar Delgado escribió:
> Hi all!
> 
> I'm trying to understand the correct use of collections mapping of the
> jackrabbit OCM.
> 
> 	@Collection(proxy=true, 
> 			  elementClassName=SomeClass.class,
> collectionConverter=NTCollectionConverterImpl.class)
> 
> I found something like this but I really don't understand what's going
> on with this.
> 
> Is there any good explanation about how to use? The main page is almost
> empty...
> 
> Thank you.
> 
> 
> 
> 
> 
> 
> 
> ____________________________________
> 
> 
> 
> 
>   Gonzalo Aguilar Delgado
>   Consultor CRM - Ingeniero en
> Informática
>         M. +34 607814276
> 
> 
> 
> 
> 
> 
> 
> 
> 
>