Hi David,
At first sight the relationships look correct. I have an entity that can hold
three different pictures, so I decided to use three attributes, one for each
picture. The pictures are optional. The database is being updated to a certain
level, since I can see that the private keys are being automatically
incremented. As can be seen in the picture, there are three images and the
component will complain that one of two is missing, either "Small Picture" or
"Big Picture". It doesn't matter if I try to insert just the thumbnail, leaving
the other two attachments empty, the component will always complain that
ERDatabaseAttachment must have one image, either one of the two mentioned.
I used EOModeler to create the relationships, in my database table I just
provided the columns to store the private keys for the images in ERAttachment.
The relationship is modeled as optional one-to-one, for instance
Pacote.imagemGrandeID => ERAttachment.id. This is the code generated by
EOGenerate:
public er.attachment.model.ERAttachment imagemGrande() {
return
(er.attachment.model.ERAttachment)storedValueForKey(_Pacote.IMAGEM_GRANDE_KEY);
}
public void setImagemGrande(er.attachment.model.ERAttachment value) {
takeStoredValueForKey(value, _Pacote.IMAGEM_GRANDE_KEY);
}
public void setImagemGrandeRelationship(er.attachment.model.ERAttachment
value) {
if (_Pacote.LOG.isDebugEnabled()) {
_Pacote.LOG.debug("updating imagemGrande from " + imagemGrande() + " to "
+ value);
}
if
(er.extensions.eof.ERXGenericRecord.InverseRelationshipUpdater.updateInverseRelationships())
{
setImagemGrande(value);
}
else if (value == null) {
er.attachment.model.ERAttachment oldValue = imagemGrande();
if (oldValue != null) {
removeObjectFromBothSidesOfRelationshipWithKey(oldValue,
_Pacote.IMAGEM_GRANDE_KEY);
}
} else {
addObjectToBothSidesOfRelationshipWithKey(value,
_Pacote.IMAGEM_GRANDE_KEY);
}
}
Thanks for the help,
Angelo
Em 03/08/2012, às 11:06, David Holt escreveu:
> What does your model for ERAttachment to your entity look like?
>
> What have you created the relationship(s) on?
>
> d
>
> On 2012-08-03, at 4:52 AM, Sr. Ângelo Andrade Cirino <[email protected]>
> wrote:
>
>> Hi,
>>
>> By disabling the properties for migrations in my application's properties
>> file I was able to launch the app, but I am getting an error trying to use
>> ERAttachment with D2W and three properties bound to ERD2WDisplayAttachment
>> for editing. The D2W interface presents the error shown in the following
>> screen capture:
>>
>> <Captura de Tela 2012-08-02 às 22.12.48.png>
>>
>> and the console reports this (among similar messages):
>>
>> Ago 02 22:03:20 Visiontur[60741] DEBUG NSLog Page:
>> er.modern.look.pages.ERMODTabInspectPage - Configuration: EditPacote -
>> Updating primary key value for ERAttachment in PK table named: EO_PK_TABLE
>> to seed value: 21
>> Ago 02 22:03:20 Visiontur[60741] DEBUG NSLog Page:
>> er.modern.look.pages.ERMODTabInspectPage - Configuration: EditPacote -
>> evaluateExpression: <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression:
>> "UPDATE EO_PK_TABLE SET PK = 21 WHERE NAME = 'ERAttachment' AND PK = 20"
>> withBindings: >
>> Ago 02 22:03:20 Visiontur[60741] DEBUG NSLog Page:
>> er.modern.look.pages.ERMODTabInspectPage - Configuration: EditPacote - ===
>> Commit Internal Transaction
>>
>> Strangely, the bindings are missing. I am not sure what this means, but
>> maybe the ERD2WDisplayAttachment component needs some tweaking through rules
>> that I am missing. The specific rule I am using is this:
>>
>> 100 : ((task = 'edit' or task = 'create') and (propertyKey = 'miniatura' or
>> propertyKey = 'imagemPequena' or propertyKey = 'imagemGrande')) =>
>> componentName = "ERMD2WEditAttachment"
>> [com.webobjects.directtoweb.Assignment]
>>
>> Thanks,
>>
>> Angelo
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
>>
>> This email sent to [email protected]
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]