This one time, at band camp, Orjan Palsson said:

OP>
OP>I would like to make a many to many relation with a role classifier on
OP>the relation. Is it possible with Castor JDO? In that case - how? I have
OP>checked the JDO examples and the test cases, and there are only normal
OP>many-many relations without role classifier.
OP>
OP>/ Orjan
OP>
OP>Below is an example of the mapping file and the corresponding tables:
OP>
OP><mapping>
OP>
OP>  <key-generator name="MAX" alias="normal">
OP>  </key-generator>
OP>
OP>  <class name="Station"
OP>         identity="id" key-generator="normal">
OP>    <description>A station participating in a session</description>
OP>    <map-to table="Station" />
OP>    <field name="id" type="integer" >
OP>      <sql name="stationId" type="integer"/>
OP>    </field>
OP>    <field name="name" type="string">
OP>      <sql name="name" type="varchar" />
OP>    </field>
OP>  </class>
OP>
OP>  <class name="Session"
OP>         identity="id" key-generator="normal">
OP>    <description>A send/receive session</description>
OP>    <map-to table="Session" />
OP>    <field name="id" type="integer" >
OP>      <sql name="sessionId" type="integer"/>
OP>    </field>
OP>    <field name="name" type="string">
OP>      <sql name="name" type="varchar" />
OP>    </field>
OP>    <field name="participants" type="Station"
OP>           collection="vector">
OP>      <sql name="stationId"
OP>           many-table="Participant" many-key="sessionId"/>
OP>    </field>
OP>  </class>
OP>
OP></mapping>
OP>
OP>Create table Session (
OP>    sessionId Int NOT NULL ,
OP>    name Varchar(20) ,
OP>    UNIQUE (sessionId),
OP> Primary Key (sessionId));
OP>
OP>Create table Station (
OP>    stationId Int NOT NULL ,
OP>    name Varchar(20),
OP>    UNIQUE (stationId),
OP> Primary Key (stationId));
OP>
OP>Create table Participant (
OP>    role Char(5) NOT NULL ,                // SEND, RECEIVE, etc.
OP>    stationId Int NOT NULL ,
OP>    sessionId Int NOT NULL ,
OP> Primary Key (stationId,sessionId));

Orjan,

The JDO examples provide an example of a many-to-many mapping between
Product and Category. Is this not sufficent? However, seeing the
DDL above, I don't see how Participant.role would be a many-to-many?
Can you explain further what you want to do?

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