views:

6

answers:

1

I need to map a collection of components with compass (using XML mapping)... Is there any way to achieve this? Thanks in advance for any suggestions.

Example classes:

class ClassA {
    private Set<ClassB> bs;
    // ... getBs/setBs ...
}
class ClassB {}

Example mapping:

<class name="com.package.ClassA" alias="classA">
     <!-- no idea how I can map Set<ClassB> in here... can I? -->
</class>
<class name="com.package.ClassB" alias="classB">
</class>
A: 

Yeah, just found out how to do this, the mapping is simple - you just apply the alias to the collection component/reference. Obviously all the rest is done implicitely.

<class name="com.package.ClassA" alias="classA">
     <component name="bs" ref-alias="classB" />
</class>
<class name="com.package.ClassB" alias="classB">
</class>
PeterP