Re: Can't get automatic inverse relationships to work
Re: Can't get automatic inverse relationships to work
- Subject: Re: Can't get automatic inverse relationships to work
- From: Mike Schrag <email@hidden>
- Date: Wed, 8 Oct 2008 12:58:37 -0400
Are you using the newer wonder eogen file that talks about automatic
inverse updating?
Your underscore file for a to-one should look roughly like:
public er.attachment.model.ERAttachment avatar() {
return
(er.attachment.model.ERAttachment)storedValueForKey("avatar");
}
public void setAvatar(er.attachment.model.ERAttachment value) {
takeStoredValueForKey(value, "avatar");
}
public void setAvatarRelationship(er.attachment.model.ERAttachment
value) {
if (_Person.LOG.isDebugEnabled()) {
_Person.LOG.debug("updating avatar from " + avatar() + " to " +
value);
}
if
(er
.extensions
.eof
.ERXGenericRecord
.InverseRelationshipUpdater.updateInverseRelationships()) {
setAvatar(value);
}
else if (value == null) {
er.attachment.model.ERAttachment oldValue = avatar();
if (oldValue != null) {
removeObjectFromBothSidesOfRelationshipWithKey(oldValue,
"avatar");
}
} else {
addObjectToBothSidesOfRelationshipWithKey(value, "avatar");
}
}
On Oct 8, 2008, at 12:35 PM, Fredrik Lindgren wrote:
I use all this in my app:
extend ERXApplication
extend ERXSession
extend ERXGenericRecord
use ERXEC.newEditingContext()
In properties i do this:
er.extensions.ERXEC.safeLocking=true
er.extensions.ERXEnterpriseObject.updateInverseRelationships=true
When a set a one relationship from a form (without using the
setXXXRelationship) the relationship does not update on the other
side!
When using the setXXXRelationship it all works.
Am I missing something?
Regards
/Fredrik
_________________________________________________________________
drop, Kålsängsgränd 10 B, 753 19 UPPSALA, Sweden
_______________________________________________
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