Re: ERAttachment error
Re: ERAttachment error
- Subject: Re: ERAttachment error
- From: Ângelo Andrade Cirino <email@hidden>
- Date: Mon, 10 Sep 2012 13:33:11 -0300
Hi,
Kieran's suggestion did not solve the problem. Following the suggestion, after looking at MySQL's docs, I set up sql_mode='traditional' in my.conf and restarted the server, to no avail.
Setting com.webobjects.eoaccess.ERXEntityDependencyOrderingDelegate.active=true did raise a circular relationship exception. I will try Frontbase…
Angelo
Em 10/09/2012, às 12:45, Ramsey Gurley escreveu:
> Just thought I would add… You can sorta have FK constraints in MySQL if you add the property
>
> com.webobjects.eoaccess.ERXEntityDependencyOrderingDelegate.active=true
>
> You still can't have circularly required relationships with FKs though. For that, you'll need a different database.
>
> Ramsey
>
> On Sep 10, 2012, at 7:22 AM, Kieran Kelleher wrote:
>
>> My guess is that the order of save operations means that sometimes you are not violating the foreign constraint and other times you are. Bottom line, MySQL does not support DEFERRED Foreign Key Constraints, so the easy fix is to eliminate Foreign Key constraints in the database if you use MySQL unfortunately. You can still set FK fields NOT NULL in the DB (of course you must set STRICT_SQL mode to prevent INT(11) NOT NULL; silently turning into INT(11) NOT NULL DEFAULT '0'; ...... details, details :) )
>>
>> On Sep 10, 2012, at 3:43 AM, Ângelo Andrade Cirino <email@hidden> wrote:
>>
>>> Hi,
>>>
>>> As I said in a previous post, I have two applications using the same framework. In one of them I am able to use ERAttachments to add an image to an entity. But in the other application, trying to attach an image to an entirely different entity, I have the following:
>>>
>>> EOGeneralAdaptorException: 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:18160(size), 2:2(attachmentDataID), 3:true(available), 4:2012-09-10 04:16:43(creationDate), 5:"image/jpeg"(mimeType), 6:"miniatura.jpg"(originalFileName), 7:"/1.jpg"(webPath), 8:1(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 (`visionturtestes`.`erattachment`, CONSTRAINT `ERAttachment_attachmentDataID_id_FK` FOREIGN KEY (`attachmentDataID`) REFERENCES `ERAttachmentData` (`id`))
>>> at com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextInformationAdded(EODatabaseContext.java:4504)
>>>
>>> The two applications are running simultaneously and I am updating one different entity in each one. Why does the same function present two different behaviours?
>>>
>>> BTW, the ERAttachment used to work perfectly in the troubled application.
>>>
>>> BTW 2: rule files that used to be loaded aren't being loaded anymore.
>>>
>>> BTW 3: if I clean the models framework and the applications and rebuild them the error above is gone, for a while...
>>>
>>> Angelo
>>> _______________________________________________
>>> 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
>>
>> _______________________________________________
>> 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
>
_______________________________________________
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