• 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
Models confused?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Models confused?


  • Subject: Models confused?
  • From: Jesse Tayler <email@hidden>
  • Date: Wed, 22 Dec 2010 12:53:16 -0500

I've had ERAttachment tests working once or twice, now I think maybe I've gotten models confused somewhere perhaps.

I have a poster relationship from user which eogen's a line to add a foreign key, which I think should be there, but this step fails - in past experience, this has been mismatched id key types, but I don't see that here.

Everything is setup with "id" as a prototype for mysql.

I see some similar troubles with Postgres on the list or google, but I'm on Mysql and just starting a new dev. environment etc.

This foreign key should be there right? Any ideas why it might be failing?






		userTable.addForeignKey("posterId", "ERAttachment", "id");

Can't create table 'mtly.#sql-731_26c3' (errno: 150)

Failed to execute 'ALTER TABLE USER ADD CONSTRAINT USER_posterId_posterId_FK FOREIGN KEY (posterId) REFERENCES ERAttachment (id)'.




If I ignore, I'll get a runtime:




com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: : Next exception:SQL State:23000 -- error code: 1452 -- msg: Cannot add or update a child row: a foreign key constraint fails (`mtly`.`ERAttachment`, CONSTRAINT `ERAttachment_attachmentDataID_attachmentDataID_FK` FOREIGN KEY (`attachmentDataID`) REFERENCES `ERAttachmentData` (`id`))

Reason:
EvaluateExpression failed: <com.webobjects.jdbcadaptor._MySQLPlugIn$MySQLExpression: "INSERT INTO ERAttachment(size, width, height, attachmentDataID, available, thumbnail, creationDate, ownerID, configurationName, smallData, mimeType, originalFileName, webPath, id, proxied, storageType) VALUES (?, NULL, NULL, ?, ?, NULL, ?, NULL, NULL, NULL, ?, ?, ?, ?, ?, ?)" withBindings: 1:73207(size), 2:2(attachmentDataID), 3:true(available), 4:2010-12-21 22:23:33(creationDate), 5:"image/jpeg"(mimeType), 6:"jesseheadshot.jpg"(originalFileName), 7:"/2.jpg"(webPath), 8:2(id), 9:true(proxied), 10:"db"(storageType)>: Next exception:SQL State:23000 -- error code: 1452 -- msg: Cannot add or update a child row: a foreign key constraint fails (`mtly`.`ERAttachment`, CONSTRAINT `ERAttachment_attachmentDataID_attachmentDataID_FK` FOREIGN KEY (`attachmentDataID`) REFERENCES `ERAttachmentData` (`id`))
 _______________________________________________
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

  • Follow-Ups:
    • Re: Models confused?
      • From: Travis Britt <email@hidden>
    • Re: Models confused?
      • From: Paul D Yu <email@hidden>
  • Prev by Date: Re: Videos?
  • Next by Date: Re: Models confused?
  • Previous by thread: Re: Videos?
  • Next by thread: Re: Models confused?
  • Index(es):
    • Date
    • Thread