Title: New bibe question - Urgent

    Hi I am new to castor I am using castor with orion server.

    I have two tables named WK_FLOW_TASK and WK_FTP.  The relation between them is inheritance i.e the WK_FLOW_TASK will have many records and each record is corresponds to either WK_FTP or WK_EMAIL or WK_REVIEW.  The relation is exactly kind of inheritance.  WK_FLOW_TASK will contain tasks and each task is one of the special tasks.  How do I map this to castor objects.

    My table structure is

    WK_FLOW (FLOW_ID, TASK_ID)
    WK_FLOW_TASK (FK_FLOW_ID, TASK_ID, TASK_TYPE, TASK_NAME)

    WK_FTP (FK_TASK_ID, USERNAME, PASSWORD)

    WK_EMAIL(FK_TASK_ID, TOADDRESS)

    In both the specific tasks the FK_TASK_ID is foriegnkey mapping to the WK_FLOW_TASK.


    I tried mapping like the following
            <class name="com.voquette.jdo.WorkFlowImpl" identity="flowId" access="shared">
                    <description>Work FlowImpl</description>
                    <cache-type capacity="10" type="count-limited"/>
                    <map-to table="WK_FLOW"/>
                    <field name="flowId" type="long">
                            <sql name="FLOW_ID" type="numeric"/>
                    </field>
                    <!--Each flow will contain different tasks-->
                    <field name="tasks" type="com.voquette.jdo.Task" collection="collection" required="true">
                            <sql many-key="FK_FLOW_ID"/>
                    </field>
            </class>
            <class name="com.voquette.jdo.Task" identity="taskId">
                    <description>Task definition</description>
                    <cache-type capacity="5" type="count-limited"/>
                    <map-to table="WK_FLOW_TASK"/>
                    <field name="taskId" type="long">
                            <sql name="TASK_ID" type="numeric"/>
                    </field>
                    <field name="taskType" type="string">
                            <sql name="TASK_TYPE" type="varchar"/>
                    </field>
                    <field name="name" type="string">
                            <sql name="NAME" type="varchar"/>
                    </field>
            </class>

            <class name="com.voquette.jdo.FTPTask" extends="com.voquette.jdo.Task" identity="taskId">
                    <description>Ftp Task Definition</description>
                    <map-to table="WK_FTP"/>
                    <field name="taskId" type="long">
                            <sql name="FK_TASK_ID" type="numeric"/>
                    </field>
                    <field name="userName" type="string">
                            <sql name="USER_NAME" type="varchar"/>
                    </field>
                    <field name="password" type="string">
                            <sql name="PASSWORD" type="varchar"/>
                    </field>
            </class>

    I don't know in the actual Java code what to do?

    Can any one please help in mapping this kind of relation.  I am in a kind of urgent need.

    Thank you all in advance.

    Kesav Kumar Kolla
    Voquette Inc
    650 356 3740(W)
    510 889 6840(R)
    Voquette....Delivering Sound Information


Reply via email to