jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart (JIRA)" <j...@apache.org>
Subject [jira] Created: (JCR-1889) Incorrect support for java interfaces in typed collection fields
Date Mon, 01 Dec 2008 20:53:44 GMT
Incorrect support for java interfaces in typed collection fields
----------------------------------------------------------------

                 Key: JCR-1889
                 URL: https://issues.apache.org/jira/browse/JCR-1889
             Project: Jackrabbit
          Issue Type: Bug
    Affects Versions: 1.4, 1.5.0
            Reporter: Christophe Lombart


If a typed collection field is defined with an Interface as the type, the following exception
is thrown when the main object is inserted : 

org.apache.jackrabbit.ocm.exception.JcrMappingException: Cannot load class interface [name
of the interface];

Here is a example : 

@Node
public class EntityA {
       @Field(path=true) String path;
       @Collection List<MyInterface> entityB;
       ....
}

When inserting a new instance of EntityA with a not null entityB, the exception is thrown.

A workaround is to add the elementClassName on the annotation @Collection. ex. : 

@Collection (elementClassName=MyInterface.class) List<MyInterface> entityB;

elementClassName is used only for untyped collections but if you specify it for a typed collection,
the ObjectContentManager will not use reflexion to check the collection class name. 
 
This should be nice to avoid the usage of elementClassName for typed collections. 



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message