Oh, this is a common mistake.  The <cmr-field-type> element is only 
allowed if the cmr field is multi-valued.  Just remove this element and 
it will work.

This is another place where the relationship metadata is completely 
dumb.  The cmr-field-type is always completely unnecessary; the field 
type can be determined using reflection.  This is how I determine the 
type of cmp fields and the return type of ejbSelect methods.

-dain

Ionel Gardais wrote:
> Here is the ejb-jar file after having describe the relationship behaviour:
> 
> <snip>
>   <relationships>
>     <ejb-relation>
>       <ejb-relation-name>Employee-Company</ejb-relation-name>
> 
>       <ejb-relationship-role>
> 
> <ejb-relationship-role-name>Employees-workat-Company</ejb-relationship-role-name>
> 
>         <multiplicity>Many</multiplicity>
>         <relationship-role-source>
>           <ejb-name>employeBean</ejb-name>
>         </relationship-role-source>
>         <cmr-field>
>           <cmr-field-name>company</cmr-field-name>
> 
> 
><cmr-field-type>fr.geomath.intranet.calendrier.ejb.cmp.company.companyLocal</cmr-field-type>
> 
>         </cmr-field>
>       </ejb-relationship-role>
> 
>       <ejb-relationship-role>
> 
> <ejb-relationship-role-name>Company-employs-Employees</ejb-relationship-role-name>
> 
>         <multiplicity>One</multiplicity>
>         <relationship-role-source>
>           <ejb-name>employeBean</ejb-name>
>         </relationship-role-source>
>       </ejb-relationship-role>
> 
>     </ejb-relation>
>   </relationships>
> </snip>
> 
> 
> As you can see, the relation is made through a company field in the
> employeBean and many employees can have only one company.
> According to this, there is no need to use a collection to create/maintain
> the relationship but JBoss complains that :
> <snip>
> org.jboss.deployment.DeploymentException: Error in ejb-jar.xml for relation
> Employee-Company: cmr-field-type should be java.util.Collection or
> java.util.Set but is
> fr.geomath.intranet.calendrier.ejb.cmp.company.companyLocal
> </snip>
> 
> 
> Does JBoss use a Collection even when it will contains only one element ?
> 
> 
> Thanks,
> ionel
> 
> Dain Sundstrom wrote:
> 
> 
>>I didn't completely follow this, but I think what you are describing
>>will work fine.
>>
>>--
>>xxxxxxxxxxxxxxxxxxxxxxxx
>>Dain Sundstrom
>>Chief Architect JBossCMP
>>JBoss Group, LLC
>>xxxxxxxxxxxxxxxxxxxxxxxx
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> PC Mods, Computing goodies, cases & more
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
PC Mods, Computing goodies, cases & more
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to