Re: Cayenne Commit Exception

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Jul 14 2005 - 13:05:02 EDT

  • Next message: Andrus Adamchik: "Re: Handling Unique Constraint Violations"

     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



    This archive was generated by hypermail 2.0.0 : Thu Jul 14 2005 - 13:05:02 EDT