Re: Cayenne Commit Exception

From: Dhruti Ramani (dhrutiraman..ahoo.com)
Date: Thu Jul 14 2005 - 13:41:48 EDT

  • Next message: Dhruti Ramani: "Re: Cayenne Commit Exception"

    the behaviour I am looking for is "HostEnterprise" object has all deal states (New, Dead and DeadFinal) but Deal can have only one of them. And different deal can have different states. In our application user will select state for particular deal from drop down list box and that list will come from HostEnterprise.
     
    What do I do to model this?
    Thanks,
    Denna

    Andrus Adamchik <andru..bjectstyle.org> wrote:
    From what you describe this is not "1..1", it is "1..n", i.e. there
    is only one instance of each state type, but multiple deals that can
    share those states. If this is indeed the case, then map it as
    "1..m", if not and you want to preserve "1..1", then create a new
    instance of state whenever you create a new instance of Deal, don't
    reuse a state from another deal.

    Andrus

    On Jul 14, 2005, at 7:29 PM, Dhruti Ramani wrote:

    > I have a object called AbstractDealState and that has these sub
    > classes,
    > à DeadDealState
    > à NewDealState
    > à DeadFinalState
    > To model this in cayenne I am using single table inheritance
    > concept. Now I have another object called Deal. And there is 1 to 1
    > relation between AbstractDealState and Deal and I joined then by
    > abstractDealState_id(PK of AbstractDealState) and
    > abstractDealState_id(FK of Deal). No "toDepk" checked.
    >
    > If I create first Deal and set the state as “NewDealState” then it
    > works. Then if I try to create another Deal with same state then it
    > will throw cayenne commit exception that
    >
    > “Cannot inset a duplicate key into unique key.”
    >
    > What am I doing wrong here?
    > Thanks,
    > Denna

                    
    ---------------------------------
     Start your day with Yahoo! - make it your home page



    This archive was generated by hypermail 2.0.0 : Thu Jul 14 2005 - 13:41:49 EDT