UndefinedTypeConverterImpl : can be used to map any 'mappable' atomic types.
If you are looking for a magic converter implementation that can map any java.lang.Object I am sorry to tell you that there does not exist any! OCM is not an interface to an Obejct database which can persist any serializable object. Here the objective is to map an object as nodes and attributes to a Jcr repository so that the data can be seamlessly indexed, retrieved and persisted. You can have an property of the type java.lang.Object. However you need to ensure that all the possible types that can be plugged into that property should be mapped through a mapping xml file. Thanks boni -----Original Message----- From: Boni Gopalan (BioImagene) [mailto:[EMAIL PROTECTED] Sent: 17 November 2008 11:22 To: [email protected] Subject: RE: Annotating a java.io.File type field in OCM Fard: Use org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl. UndefinedTypeConverterImpl as your converter. It should resolve the issue you are facing. <pre> @Field(converter=UndefinedTypeConverterImpl.class) </pre> Thanks boni -----Original Message----- From: Fard [mailto:[EMAIL PROTECTED] Sent: 14 November 2008 20:03 To: [email protected] Subject: Re: Annotating a java.io.File type field in OCM Hello Christophe, As I explained the type of the field is java.lang.Object but I assigned a String type variable to it. This variable could be any primitive type or any type I had created. On the other hand I used @Field Converter and I got the below error as i expected because when I use @Field Converter for a field the type of that field should be one of Atomic Type but the type is java.lang.Object. Is it any way that I solve my problem. Regards Maurice Fard Start the tutorial ... Insert a press release in the repository Exception in thread "main" org.apache.jackrabbit.ocm.exception.RepositoryException: null; nested exception is org.apache.jackrabbit.ocm.exception.IncorrectAtomicTypeException: No registered converter for a field based on the class :'class java.lang.Object' org.apache.jackrabbit.ocm.exception.IncorrectAtomicTypeException: No registered converter for a field based on the class :'class java.lang.Object' at org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl.AtomicTypeCon verterProviderImpl.getAtomicTypeConverter(AtomicTypeConverterProviderImp l.java:73) at org.apache.jackrabbit.ocm.manager.objectconverter.impl.SimpleFieldsHelpe r.getAtomicTypeConverter(SimpleFieldsHelper.java:333) at org.apache.jackrabbit.ocm.manager.objectconverter.impl.SimpleFieldsHelpe r.storeSimpleField(SimpleFieldsHelper.java:264) at org.apache.jackrabbit.ocm.manager.objectconverter.impl.SimpleFieldsHelpe r.storeSimpleFields(SimpleFieldsHelper.java:230) at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insert(ObjectConverterImpl.java:223) at org.apache.jackrabbit.ocm.manager.beanconverter.impl.DefaultBeanConverte rImpl.insert(DefaultBeanConverterImpl.java:53) at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insertBeanFields(ObjectConverterImpl.java:810) at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insert(ObjectConverterImpl.java:224) at org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insert(ObjectConverterImpl.java:153) at org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.insert(O bjectContentManagerImpl.java:406) at org.apache.jackrabbit.ocm.Main.startTutorial(Main.java:60) at org.apache.jackrabbit.ocm.Main.main(Main.java:134) Christophe Lombart wrote: > > Because @Bean cannot be used with primitive types (or their wrapper > classes). You should use @Field. > > > > On Thu, Nov 13, 2008 at 15:52, Fard <[EMAIL PROTECTED]> wrote: > >> >> Hi Christophe, >> >> Thank you for replay. I have another problem that I could not solve it. >> One >> of my field has java.lang.Object type and I would like to map it. I >> downloaded second tutorial code sample "How to map associations between >> objects" and I added one field to Author class as Object type and I used >> Bean Converter for it >> >> @Bean private Object value; >> { setter and getter } >> >> In the startTutorial method of Main class I added >> >> String value = new String("This is a value for Object."); >> pressRelease.getAuthor().setValue(value); >> >> As you Know Author class is a field of PressRelease class that has the >> Bean >> Converter. >> >> I got the below error. I hope there is a solution for this problem. >> Thanks >> for any help. >> >> Regards >> Maurice >> >> Start the tutorial ... >> Insert a press release in the repository >> Exception in thread "main" >> org.apache.jackrabbit.ocm.exception.RepositoryException: null; nested >> exception is >> org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException: >> Class >> of type: java.lang.String has no descriptor. >> org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException: >> Class >> of type: java.lang.String has no descriptor. >> at >> >> org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl.getClassDescrip torByClass(AbstractMapperImpl.java:203) >> at >> >> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insertBeanFields(ObjectConverterImpl.java:810) >> at >> >> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insert(ObjectConverterImpl.java:224) >> at >> >> org.apache.jackrabbit.ocm.manager.beanconverter.impl.DefaultBeanConverte rImpl.insert(DefaultBeanConverterImpl.java:53) >> at >> >> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insertBeanFields(ObjectConverterImpl.java:810) >> at >> >> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insert(ObjectConverterImpl.java:224) >> at >> >> org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterIm pl.insert(ObjectConverterImpl.java:153) >> at >> >> org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl.insert(O bjectContentManagerImpl.java:406) >> at org.apache.jackrabbit.ocm.Main.startTutorial(Main.java:60) >> at org.apache.jackrabbit.ocm.Main.main(Main.java:134) >> >> >> >> Christophe Lombart wrote: >> > >> > JCR doesn't support java.io.File but you can create a utility method to >> > get >> > the InputStream from a File. >> > InputStream is supported in Jackrabbit OCM. >> > >> > Christophe >> > >> > >> > On Thu, Nov 13, 2008 at 01:42, Fard <[EMAIL PROTECTED]> wrote: >> > >> >> >> >> Hello there, >> >> >> >> One of my filed has java.io.File type. I don't know how can I annotate >> it >> >> in >> >> OCM. It is not @Field and it is not @Bean. >> >> >> >> Thanks for any help >> >> >> >> Maurice >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Annotating-a-java.io.File-type-field-in-OCM-tp2047 2733p20472733.html >> >> Sent from the Jackrabbit - Users mailing list archive at Nabble.com. >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Annotating-a-java.io.File-type-field-in-OCM-tp2047 2733p20481630.html >> Sent from the Jackrabbit - Users mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Annotating-a-java.io.File-type-field-in-OCM-tp2047 2733p20501582.html Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
