Hello!

I have a problem creating a to-many relationship using Castor. The framework
says my Collection-Getter Method should not return the
Collection-Implementation I specified, but the Type of the elements in the
collection (like it was no to-many reference at all). Can anybody tell me
what I did wrong?

mapping.xml:

  <class name="UARoles"
         identity="rolesID" access="db-locked">
    <description>UA Roles</description>
    <map-to table="ADS_RoleTables" xml="roles" />

    <field name="roleChanges" type="UARoleChange" required="true"
collection="arraylist">
      <sql many-key="ROLES_ID"/>
      <xml node="element"/>
    </field>
  </class>

  <class name="UARoleChange"
         identity="changeID" access="db-locked" depends="UARoles">
    <description>UA Role Change</description>
    <map-to table="ADS_RoleChanges" xml="rolechanges" />
    <field name="uARoles" type="UARoles">
      <sql name="ROLES_ID" />
      <xml name="uaroles" node="element" reference="true"/>
    </field>
  </class>

Error:

org.exolab.castor.mapping.MappingException: The return type for method
public java.util.ArrayList UARoles.getRoleChanges() does not match the
declared field type UARoleChange
        at
org.exolab.castor.mapping.loader.MappingLoader.findAccessor(MappingLoader.ja
va:1088)
        at
org.exolab.castor.mapping.loader.MappingLoader.createFieldHandler(MappingLoa
der.java:847)
        at
org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc(MappingLoader
.java:696)
        at
org.exolab.castor.jdo.engine.JDOMappingLoader.createFieldDesc(JDOMappingLoad
er.java:246)
        at
org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(MappingLoade
r.java:559)
        at
org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoade
r.java:382)
        at
org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(JDOMappingLoa
der.java:147)
        at
org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader.jav
a:232)
        at
org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(JDOMappingLoader.j
ava:295)
        at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:291)
        at
org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.
java:300)

Thanks for the help,

          Christian Hinken.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to