Sorry I had to repost this issue, I'm still having problems with it. Even
when I try to fake short transaction when inserting new Skill to the Worker
skill collection.
/**
*-- previous message thread:"JDO Mapping Problem"---*
*/
I have a situation where there is a list of pre-defined skills
in the SKILL table and each worker may have many skills, therefore
I have a collection of skill in the Worker class.
I am able to read & remove skills from the collection but when I
insert a skill in the collection, castor tries to Insert an new
record in the skill table as well as the workerskill table.
How do I get it to write only to the workerskill table?
Thank you.
<!-- Table: WORKER -->
<class name="isman.base.person.Worker"
extends="isman.base.person.Colleague"
identity="key">
<description>Person</description>
<map-to table="WORKER" xml="Worker"/>
<!-- +++++++++++++++++++++++++++++++++ -->
<field name="key" type="integer" >
<sql name="WORKERKEY" type="integer"/>
<bind-xml node="attribute"/>
</field>
<field name="lastName" type="string" >
<sql name="LASTNAME" type="varchar"/>
<bind-xml node="attribute"/>
</field>
<!-- education File -->
<field name="educationFile" type="isman.base.Education"
collection="collection">
<sql many-key="PARENTKEY"/>
<bind-xml name="education" node="element"/>
</field>
<!-- employment history File -->
<field name="historyFile" type="isman.base.WorkHistory"
collection="collection">
<sql many-key="PARENTKEY" />
<bind-xml name="history" node="element"/>
</field>
<!-- SKILLS -->
<field name="skills" type="isman.base.Skill"
collection="collection">
<sql many-table="WORKERSKILL" many-key="WORKERKEY"/>
<bind-xml name="skills" node="element"/>
</field>
</class>
<!-- Table: SKILL -->
<class name="isman.base.Skill"
access="shared" identity="key">
<description>Table with existing skills</description>
<map-to table="SKILL" />
<field name="key" type="integer" required="true">
<sql name="SKILLKEY" type="integer" />
</field>
<field name="name" type="string">
<sql name="NAME" type="varchar"/>
</field>
<field name="description" type="string">
<sql name="DESCRIPTION" type="varchar"/>
</field>
<field name="workers" type="isman.base.person.Worker"
collection="collection"
required="false">
<sql many-table="WORKERSKILL" many-key="SKILLKEY" dirty="ignore"/>
</field>
</class>
the primary keys in the tables are as follows:
WORKER - workerkey
WORKERSKILL - workerkey, skillkey
SKILL - skillkey
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev