Hi Bruce,
I need to elaborate this.

        Here is the mapping  for Profile:
        <!-- PROFILE --->
        <class name="dataaccess.Profile" identity="id">
                <description>Profile</description>
                <map-to table="PROFILE_T" xml="right" />
                <field name="id" type="string" >
                        <sql name="id" type="varchar" />
                        <bind-xml name="id" node="attribute" />
                </field>
                <field name="name" type="string" >
                        <sql name="name" type="varchar" />
                        <bind-xml name="name" node="element" />
                </field>
                <field name="description" type="string" >
                        <sql name="description" type="varchar" />
                        <bind-xml name="description" node="element" />
                </field>

                <!-- rights of the profile -->
                <field name="right" type="dataaccess.Right" collection="vector">
                        <sql name="rightid" many-table="PROFILE_RIGHT_T" 
many-key="profileid" />
                </field>

                <!-- how to do for profileRights  , also xsd if possible  -->
        </class>

        <!-- RIGHT -->
        <class name="dataaccess.Right" identity="id">
                <description>Right</description>
                <map-to table="RIGHT_T" xml="right" />
                <field name="id" type="string" >
                        <sql name="id" type="varchar" />
                        <bind-xml name="id" node="attribute"/>
                </field>
                <field name="toolName" type="string" >
                        <sql name="toolName" type="varchar" />
                        <bind-xml name="toolName" node="element"/>
                </field>
        </class>

        <!-- PROFILE RIGHT -->
        <class name="dataaccess.ProfileRight" identity="profileid rightid">
                <description>ProfileRight</description>
                <map-to table="PROFILE_RIGHT_T" xml="ProfileRight" />
                <field name="profileid" type="string" >
                        <sql name="profileid" type="varchar"/>
                </field>
                <field name="rightid" type="string" >
                        <sql name="rightid" type="varchar"/>
                </field>
                <field name="rightType" type="integer" >
                        <sql name="rightType" type="integer" />
                        <bind-xml name="rightType" node="element" />
                </field>
                <field name="minimum" type="integer" >
                        <sql name="minimum" type="integer" />
                        <bind-xml name="minimum" node="element" />
                </field>
                <field name="maximum" type="integer" >
                        <sql name="maximum" type="integer" />
                        <bind-xml name="maximum" node="element" />
                </field>

                <!--- ??  What to add here , what to add xsd  if possible -->
        </class>




Yes, I had already used in "Profile" to access "Right"s of profile, and it
worked well (many-table = "PROFILE_RIGHT_T")

Since  "profile-right" has additional
fields (i.e. RightType, Minimum, Maximum) requiring ProfileRight obj which
maps to "PROFILE_RIGHT_T" table.
Maybe my classification of "PROFILE_RIGHT_T" as an intersection table is not
accurate enough. But I need  associate  profile object - profileRight
objects , if possible in mapping.xml. How can I do this?

Regards,
Emre





-----Original Message-----
From: Bruce Snyder [mailto:ferret@;frii.com]
Sent: October 21, 2002 9:01 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] many-to-many relationship


This one time, at band camp, Emre Tuvay said:

ET>Currently I working on a project to manage the rights, profiles of the
user.
ET>I am using the castor SourceGenerator to generate sources and then doing
the
ET>mapping.xml.
ET>
ET>PROFILE:
ET>Id
ET>Description
ET>CreDate
ET>
ET>RIGHT:
ET>Id
ET>Name
ET>ToolName
ET>
ET>PROFILE_RIGHT
ET>ProfileId    (FK)
ET>RightId      (FK)
ET>RightType
ET>Minimum
ET>Maximum
ET>
ET>Now, PROFILE_RIGHT is an intersection table. For a given profile how can
I
ET>load
ET>all profile_right objects ? How should the mapping look like? I also need
to
ET>maintain
ET>Minimum, maximum, rightype columns of Profile-Right.
ET>How should  xsd file  look like so that I write as minimum as possible?

Emre,

With Castor you don't map the intersection table explicitly. It is only
identified in the many-table attribute of the <sql> element.

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

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

Reply via email to