Re: Cayenne Commit Exception

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

  • Next message: John Martyniak: ""Query Has No Root" in modeler"

    I got your point. I don't know why I was thinking that I need 1 to 1 relation between those objects.
     
    Thanks, you are genius.
    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:58:38 EDT