You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Christophe Lombart (JIRA)" <ji...@apache.org> on 2009/01/18 10:08:59 UTC
[jira] Resolved: (JCR-1889) Incorrect support for java interfaces
in typed collection fields
[ https://issues.apache.org/jira/browse/JCR-1889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Christophe Lombart resolved JCR-1889.
-------------------------------------
Resolution: Fixed
Fix Version/s: 1.6.0
Fixed. From now, the attribute annotation "elementClassName" is not required for typed collections.
Now it is possible to define a collection based on an interface like the following example :
@Node
public class EntityA {
@Collection List<MyInterface> entityB;
...
}
@Node
public interface MyInterface {
...
}
> Incorrect support for java interfaces in typed collection fields
> ----------------------------------------------------------------
>
> Key: JCR-1889
> URL: https://issues.apache.org/jira/browse/JCR-1889
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-ocm
> Affects Versions: 1.4, 1.5.0
> Reporter: Christophe Lombart
> Assignee: Christophe Lombart
> Fix For: 1.6.0
>
>
> 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.