• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Constraint error when I don't think I should have one.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Constraint error when I don't think I should have one.


  • Subject: Re: Constraint error when I don't think I should have one.
  • From: Lon Varscsak <email@hidden>
  • Date: Sat, 16 May 2009 02:24:21 -0700

Yeah, this is what I thought it was at first, but the order of the sql statements is always correct (even when it fails). :(

-Lon

On Fri, May 15, 2009 at 1:44 PM, Chuck Hill <email@hidden> wrote:
EOF can change the order that these are sent to the database.  Is there any chance that the order that is causing the error is not the order you show in your message?

Chuck


On May 15, 2009, at 1:16 PM, Lon Varscsak wrote:

Sorry, it's really not that confusing

OrderHeader
   ->> OrderDetailSales
             -> OrderDetailCost

The values in the objects are fine, the pk's are fine, the insert order appears to be fine (OrderHeader then OrderDetailSales then OrderDetailCost) so the db constraint should be a problem, but for some reason SOMETIMES it is.  It's weird, I can run it once and everything gets into the database fine, I can run it again (with no code changes) and it will fail.

-Lon

On Fri, May 15, 2009 at 12:35 PM, David Avendasora <email@hidden> wrote:

On May 15, 2009, at 3:09 PM, Lon Varscsak wrote:

This is a complete shot in the dark, but how does Sybase handle constraints within one transaction? Would the OrderHeader insert have to be committed before you can issue an INSERT into a related table?

As long as it's in the transaction it should be okay.  I'm wondering if it's not really in a transaction...but in the end I end up with no rows as I would expect in an error condition.

If that's not it, what is the actual order_detlcost_ordhdr constraint? Is it a compound FK?

It's just based on order_number.

Also, I don't know your business case, but It seems odd that the OrderDetailCost entity would be related directly to the OrderHeader entity and not to the OrderDetail entity.

Technically it's not, it's really directly related to OrderDetailSale (which is inserted before the cost record as well...I just left out that detail), but I didn't setup the foreign keys (that was long before me).  However, the foreign key itself has been in place for over a decade, and I have old code (Obj-c) that is fine.

This is confusing. Maybe you can give a more detailed model without leaving anything out?


I'm really wondering if this has to do with the way jdbc/jconnect deal with autocommit.

Well, it appears that there was at one time an EOF SybasePlugIn in Wonder that was created specifically to deal with PK generation issues. See: http://osdir.com/ml/web.webobjects.woproject.cvs/2003-09/msg00166.html

It doesn't appear to be part of the Wonder source anymore, though.

Dave


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

--
Chuck Hill             Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Constraint error when I don't think I should have one. (From: Lon Varscsak <email@hidden>)
 >Re: Constraint error when I don't think I should have one. (From: David Avendasora <email@hidden>)
 >Re: Constraint error when I don't think I should have one. (From: Lon Varscsak <email@hidden>)
 >Re: Constraint error when I don't think I should have one. (From: David Avendasora <email@hidden>)
 >Re: Constraint error when I don't think I should have one. (From: Lon Varscsak <email@hidden>)
 >Re: Constraint error when I don't think I should have one. (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Curly Generics Question - Update
  • Next by Date: Re: Curly Generics Question - Update
  • Previous by thread: Re: Constraint error when I don't think I should have one.
  • Next by thread: [OT] JD-Eclipse plug-in available for Mac OS X
  • Index(es):
    • Date
    • Thread