Re: optional 1:1 relation, how to?

From: Jürgen Saar (jsaa..eb.de)
Date: Fri Mar 11 2005 - 16:07:54 EST

  • Next message: Sami Mohammed: "Re: Relationship between tables"

    Yeah ... fine
    I searched for it on the relation-options

    Thanx

    cayenne-use..bjectstyle.org schrieb am 11.03.05 14:59:15:
    >
    > =?iso-8859-1?Q? J=FCrgen=20Saar ?= <jsaa..eb.de> wrote:
    > > Hi,
    > >
    > > I have some Entities that have optional informations attached via a 1:1
    > relation.
    > > If I insert such an entity, and for the actual object there is no
    > > such additional information, the validation fails
    > > with the error-message "relAddtional is required"
    > >
    > > Is there a way to configure a 1:1 relation as optional (like an outer
    > join)
    >
    > Change "mandatory" to false for your dbAttribute in the Cayenne modeler.
    >
    > Ie, assuming your object.relAddtional() relationship is based on the value
    > of the OBJECT.REL_ADDITIONAL field, go to OBJECT (not object) and select
    > attribute tab.
    >
    > Alternately, you can go in and just edit the DataMap.xml file and change (or
    > remove) the value of mandatory directly.
    >
    > For example, here's what it looks like for creditCard() to be optional on my
    > PaymentMethod object. Note that since there is no "isMandatory" attribute
    > on PAYMENT_METHOD.CREDIT_CARD_ID, it defaults to false.
    >
    > <db-relationship name="creditCard" source="PAYMENT_METHOD"
    > target="CREDIT_CARD" toMany="false">
    > <db-attribute-pair source="CREDIT_CARD_ID" target="CREDIT_CARD_ID"/>
    > </db-relationship>
    >
    > <db-entity name="PAYMENT_METHOD">
    > <db-attribute name="ACCOUNT_NUMBER" type="INTEGER" isMandatory="true"
    > length="8"/>
    > <db-attribute name="CREDIT_CARD_ID" type="INTEGER" length="8"/>
    >

    ______________________________________________________________
    Verschicken Sie romantische, coole und witzige Bilder per SMS!
    Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193



    This archive was generated by hypermail 2.0.0 : Fri Mar 11 2005 - 16:08:20 EST