This one time, at band camp, Belugin Max said:

BM >org.exolab.castor.jdo.DataObjectAccessException: Type conversion error: could not 
set value of
BM >FieldMolder of 
com.espada.bugtracker.app.RoleInProject.setproject(com.espada.bugtracker.app.Project
BM >project) with value of type java.lang.Integer
BM >
BM >  <!--  Mapping for RoleInProject -->
BM >  <class name="com.espada.bugtracker.app.RoleInProject"
BM >         identity="project user role">
BM >    <description>RoleInProject</description>
BM >    <map-to table="projectuser" xml="roleinproject" />
BM >    <field name="project" type="com.espada.bugtracker.app.Project" >
BM >      <sql name="pid" />
BM >      <xml node="element"/>
BM >    </field>
BM >    <field name="user" type="com.espada.bugtracker.app.User" >
BM >      <sql name="uid" />
BM >      <xml node="element"/>
BM >    </field>
BM >    <field name="role" type="com.espada.bugtracker.app.Role" >
BM >      <sql name="rid" />
BM >      <xml node="element"/>
BM >    </field>
BM >  </class>

Max,

I believe that your issue lies in the section of the mapping
descriptor for the RoleInProject object. I'm seeing that you're
using a multi-column primary key. I'm not well versed in multi-column
primary keys, but I think I see the problem. The fields in the
RoleInproject object are complex objects, not primitives. In the
identity attribute of the class element, Castor is told to use the
complex objects rather than the primitives in those complexe objects.
However, when Castor drills down into those complex objects, it
discovers that the id for each of them is, in fact, a primitive
(each one is an integer) and throws the exception because, as the
error states, setProject is expecting a Project object.

I do know that using foreign keys in a multi-column primary key can
be very troublesome. Are you designing the database schema from the
ground up or did it already exist? I'm not sure if this would work
for your situation, but have you considered making use of nested
attributes (http://castor.exolab.org/nested-attr.html) instead?

Bruce
--

perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

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

Reply via email to