I asked this question before but the link to JDO: Views of Same Object I
don't think is what I want.
What I want is to use 1 table, and map two objects to that same table,
however I want one object contained withing the other.  Below is example XML
file of object "Useracct" it contains an object "Credentials".  I want both
these objects to come from columns in same table "useraccts".



<useracct xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="./hcdata.xsd">
        <acctid>12345</acctid>
        <credentials>
                <username>[EMAIL PROTECTED]</username>
                <pwd>#dr%3gt</pwd>
        </credentials>
        <created>2001-12-17T09:30:47-05:00</created>
</useracct> 


My mapping file I have this:


        <class name="com.thehomeconnect.core.data.Useracct"
identity="acctid">
                <description>Default mapping for class
com.thehomeconnect.core.data.Useracct</description>
                <map-to table="useraccts" xml="useracct"/>
                <field name="acctid" type="int" required="true">
                        <bind-xml name="acctid" node="element"/>
                        <sql name="acctid" type="integer"></sql>
                </field>
                <field name="credentials"
type="com.thehomeconnect.core.data.Credentials" required="true">
                        <bind-xml name="credentials" node="element"/>
                </field>
                <field name="created" type="java.util.Date" required="true">
                        <bind-xml name="created" node="element"/>
                        <sql name="created" type="timestamp"></sql>
                </field>
        </class>
        <class name="com.thehomeconnect.core.data.Credentials"
identity="acctid">
                <description>Default mapping for class
com.thehomeconnect.core.data.Credentials</description>
                <map-to table="useraccts" xml="credentials"/>
                <field name="username" type="java.lang.String"
required="true">
                        <bind-xml name="username" node="element"/>
                        <sql name="username" type="varchar"></sql>
                </field>
                <field name="pwd" type="java.lang.String" required="true">
                        <bind-xml name="pwd" node="element"/>
                        <sql name="pwd" type="varchar"></sql>
                </field>
        </class>

I'm not sure how to bind credentials in Useracct and should Credentials have
an identity? And if so what should it be?  The acctid is auto_increment.

TIA
--ekiM
R&D Hummingbird Core Services



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

Reply via email to