Hello.
I have a interesting problem with castor right now.
First the tables:
- Meeting having a id called ItemID and various other fields.
- Person having a PersonID and additional information.
- and a table called Meeting2Person with
- ItemID as foreign key to Meeting and primary key
- PersonID as foreign key to the Person table and primary key
- Status being the status if the person has accepted to come to the
meeting or not seen the invitation yet.
Obviously I do not intend to user another artificial primary key for
Meeting2Person.
And this is where the problem starts. Castor spits out the following
exception when I try to load a Meeting:
org.exolab.castor.jdo.DataObjectAccessException: Type conversion error:
could not set value of FieldMolder of
data.meeting.Meeting2Person.setperson(data.person.Person person) with value
of type java.math.BigDecimal
The generated sql code is ok, using the correct joins and keys to access
the data.
If I use a additional key, it does work. Meeting, all Meeting2Persons
together with the Persons are loaded and I can access the Meeting2Person
through the Vector of Meeting. It seems that castor gets a bit confused,
using the sql type of the PersonID and ItemID...
Or is this a feature? If someone can confirm that it is indeed a bug, I can
plan my database this way.
Otherwise I have no choice and add this key... Or did I overlook a sample
that uses exactly this ?
(I tried to inherit Meeting2Person from Person and use the extend
attribute, but even then I run into the problem as ItemID is still
primary key...)
<class name = "data.person.Person"
identity= "personID"
access = "read-only">
<map-to table="Person" />
<field name="personID" type="integer" required="true">
<sql name="PersonID" type="numeric" />
</field>
<field name="name" type="string" required="true">
<sql name="Name" type="varchar" />
</field>
</class>
<class name = "data.meeting.Meeting"
identity= "itemID">
<map-to table="Meeting" />
<field name="itemID" type="integer" required="true">
<sql name="ItemID" type="numeric" />
</field>
<field name="personen" type="data.meeting.Meeting2Person"
collection="vector">
</field>
</class>
<class name = "data.meeting.Meeting2Person"
depends = "data.meeting.Meeting"
identity= "person meeting">
<cache-type type="none" />
<map-to table="Meeting2Person" />
<field name="person" type="data.person.Person"
required="true">
<sql name="PersonID"/>
</field>
<field name="meeting" type="data.meeting.Meeting"
required="true">
<sql name="ItemID"/>
</field>
<field name="status" type="integer" required="true">
<sql name="Status" type="numeric" />
</field>
</class>
Thanks in advance, Gunnar.
--
G. Brand - interface:projects GmbH
Tolkewitzer Strasse 49
D-01277 Dresden
mail: [EMAIL PROTECTED]
tel: ++49-351-3 18 09 - 41
Ein Unternehmen der interface:business-Gruppe
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev