jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sverker Abrahamsson" <sver...@abrahamsson.com>
Subject Collection mapping with OCM
Date Sat, 13 Nov 2010 23:45:22 GMT
Hi,

I can't figure out how to configure a collection mapping with OCM. The
definition of my node type looks like this:

 

[lt:file] > nt:hierarchyNode, mix:referenceable

  orderable

  + lt:content (nt:base) 

    = lt:resource 

    mandatory multiple COPY

  + lt:sample (nt:base) 

    = lt:resource 

    multiple COPY

 

and some more child nodes and properties.

 

The first attempt was just a simple mapping like this:

 

           @Collection(jcrName="lt:content", jcrOnParentVersion="COPY")

           private List<Base> content;

 

That gives this exception:

 

00:34:08,913 ERROR [AbstractTestBase] Cannot create new node of type
lt:resource from mapped class class
com.limetransit.jcr.model.DefaultResourceImpl; nested exception is
javax.jcr.nodetype.ConstraintViolationException: No child node definition
for collection-element found in node /test/testfile/lt:content

org.apache.jackrabbit.ocm.exception.ObjectContentManagerException: Cannot
create new node of type lt:resource from mapped class class
com.limetransit.jcr.model.DefaultResourceImpl; nested exception is
javax.jcr.nodetype.ConstraintViolationException: No child node definition
for collection-element found in node /test/testfile/lt:content

javax.jcr.nodetype.ConstraintViolationException: No child node definition
for collection-element found in node /test/testfile/lt:content

 

This variant is actually working:

 

           @Collection(jcrName="lt:content", jcrElementName="lt:content",
jcrOnParentVersion="COPY", elementClassName=Base.class,
collectionConverter=NTCollectionConverterImpl.class)

           private List<Base> content;

 

but the issue with NTCollectionConverterImpl is that I have my sample node
also, which has the same node type and then this converter can't keep them
apart. Also, how does this look in the repository?

 

What would be the correct way to map these nodes?

 

Best regards

Sverker


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message