Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 76239 invoked from network); 13 Sep 2009 13:20:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Sep 2009 13:20:16 -0000 Received: (qmail 28661 invoked by uid 500); 13 Sep 2009 13:20:15 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 28643 invoked by uid 500); 13 Sep 2009 13:20:15 -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 28632 invoked by uid 99); 13 Sep 2009 13:20:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Sep 2009 13:20:15 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [217.72.192.227] (HELO fmmailgate02.web.de) (217.72.192.227) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Sep 2009 13:20:05 +0000 Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate02.web.de (Postfix) with ESMTP id 66AC011EE5685 for ; Sun, 13 Sep 2009 15:18:00 +0200 (CEST) Received: from [82.113.121.24] (helo=[10.46.18.193]) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #314) id 1Mmoxr-0006Hm-00 for users@jackrabbit.apache.org; Sun, 13 Sep 2009 15:18:00 +0200 Message-ID: <4AACF0FF.7000308@web.de> Date: Sun, 13 Sep 2009 15:17:51 +0200 From: Kadir Alaca User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: users@jackrabbit.apache.org Subject: Programming against interfaces and @Bean-Fields Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: alaca@web.de X-Sender: alaca@web.de X-Provags-ID: V01U2FsdGVkX1+zm4BTIz/XvIbifHdztuypViknLYIn+XPA0uQY 2tAQfr0Ta9RUKaOHX2ub6AbXQf478Jnqr14TYjghjEAdpNv7sB qconGPl3w= X-Virus-Checked: Checked by ClamAV on apache.org Hi, i have an interface IMyImage and its implementation in MyImageImpl. MyImageImpl has @Bean-Fields which refer to the interface IMyResource. IMyResource is implemented in MyResourceImpl. But here the related code: @Node(isInterface=true, jcrType="my:bag", discriminator=false) public interface IMyBag { //getter and setter defs for path, uuid and other } @Node(isInterface=true, jcrType="my:image", extend=IMyBag.class, discriminator=false) public interface IMyImage extends IMyBag { IMyResource getImage(); void setImage(IMyResource resource); //... } @Node(isInterface=true, jcrType="my:resource", discriminator=false) public interface IMyResource { InputStream getData(); void setData(InputStream data); //... } @Node(jcrType="my:bagimpl", isAbstract=false, discriminator=false) @Implement(interfaceName=IMyBag.class) public class MyBagImpl implements IMyBag { @Field(path = true) private String path; @Field(uuid=true) private String UUID; //... } @Node(jcrType="my:imageimpl", extend=MyBagImpl.class, discriminator=false) @Implement(interfaceName=IMyImage.class) public class MyImageImpl extends MyBagImpl implements IMyImage { @Bean(jcrName="my:image", proxy=true, converter=DefaultBeanConverterImpl.class) protected IMyResource image; public IMyResource getImage() { return image; } public void setImage(IMyResource image) { this.image = image; } //... } @Node(jcrType="my:resourceimpl", isAbstract=false, discriminator=false) @Implement(interfaceName=IMyResource.class) public class MyResourceImpl implements IMyResource { @Field(jcrName="my:binarydata") protected byte[] binarydata; public byte[] getBinarydata() { return binarydata; } public void setBinarydata(byte[] binarystream) { this.binarydata = binarystream; } public InputStream getData() { return new ByteArrayInputStream(this.binarydata); } public void setData(InputStream data) { this.binarydata = FileUtils.toByteArray(data); } //... } When i insert such an image, OCM works pretty fine. Applying an update on that inserted image results to the following exception: Repository access exception; nested exception is org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException: Class of type: java.lang.Object has no descriptor. org.springmodules.jcr.JcrSystemException: Repository access exception; nested exception is org.apache.jackrabbit.ocm.exception.IncorrectPersistentClassException: Class of type: java.lang.Object has no descriptor. I have debugged OCM and found that public static Class getBeanClass(Object bean) { Class beanClass = bean.getClass(); if (isProxy(beanClass)) { //CGLIB specific return beanClass.getSuperclass(); } return beanClass; } in org.apache.jackrabbit.ocm.reflection.ReflectionUtils returns java.lang.Object for the field protected IMyResource image; The return value is used in ObjectConverterImpl to retrieve the ClassDescriptor for the Bean: ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object)); Of course there is no descriptor for java.lang.Object. When i implement the same structure with concrete classes, OCM works fine. The relevant technology-stack: + jackrabbit 1.6.0 with ocm 1.5.3 + spring 2.5.6 + springmodules 0.9 - with patch from http://jira.springframework.org/browse/MOD-446 + tomcat 6.0.18 + cglib How can i improve my code or maybe OCM self to get done the update-thing with interfaces? Any advice is welcome. Thanks in advance, Kadir.