db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brycenesbitt <bry...@obviously.com>
Subject Re: AW: foreign-key generation maps NumberKey to int, and code fails to compile
Date Tue, 14 Aug 2007 07:38:37 GMT

Hmm, ok.  But if I flip it around like that, I don't get a
BaseCcsMemberPeer.doSelectJoinCcsCoupon().

   <table name="CCS_MEMBER">
        <column default="0" name="MEMBER_ID" primaryKey="true"
            required="true" type="INTEGER"/>
        <column default=""  name="FIRST_NAME" size="127" type="VARCHAR"/>
        <column default=""  name="LAST_NAME" size="127" type="VARCHAR"/>
    </table>
    <table name="CCS_COUPON">
        <column name="COUPON_ID"       type="INTEGER" primaryKey="true"
required="true" autoIncrement="true" />
        <column name="MEMBER_ID"       type="INTEGER" required="true" />
        <column name="EXPIRES"         type="DATE"/>
        <foreign-key foreignTable="CCS_MEMBER" onUpdate="none"
onDelete="none" name="FK_COUPON">
            <reference local="MEMBER_ID" foreign="MEMBER_ID"/>
        </foreign-key>
    </table>

How can I get a BaseCcsMemberPeer.doSelectJoinCcsCoupon(), which will do
essentially:
   SELECT * from CCS_MEMBER JOIN CCS_COUPON USING (MEMBER_ID);

All I get is BaseCcsCouponPeer.doSelectJoinCcsMember() method, which
"selects a collection of CcsCoupon objects pre-filled with their CcsMember
objects".  But this is useless, since there can be only one member per
coupon!  I want a member object, with a list of (zero or more) coupons.



Thoralf Rickert wrote:
> 
> I'm not sure if I understand you problem. But does it make sense to
> declare a foreign key for primary key in the same table? Normally you
> declare the foreign key in COUPON and make a reference to MEMBER. Maybe
> Torque doesn't "like" this double "key-definition" in MEMBER. But I'm not
> sure....
> 
> bye
> Thoralf
> 

-- 
View this message in context: http://www.nabble.com/foreign-key-generation-maps-NumberKey-to-int%2C-and-code-fails-to-compile-tf4265600.html#a12140061
Sent from the Apache DB - Torque Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message