issue with a nested editing context [long]
issue with a nested editing context [long]
- Subject: issue with a nested editing context [long]
- From: Marius Strumyla <email@hidden>
- Date: Thu, 6 May 2004 18:35:14 -0400
Hello everybody,
I have a nested editing context.
EOEditingContext ctx = new
EOEditingContext(session().defaultEditingContext());
I fetch some EO objects through it. My EOs have a couple of attributes -
property1 and property2. Both attributes have validate methods in my EO:
public String validateProperty1(String new) { ... }
public String validateProperty2(String new) { ... }
Sometimes I need to validate the properties sometimes I don't. So in EO
contructor I create a vector which properties to validate. In validate
methods, I just check whether the vector contains the property:
public String validateProperty1(String new) {
// If vector doesn't contain the property, don't validate it.
if (!mRequiredProperties.contains("property1")) return new;
// else validate the property
...
}
If I decide I don't want to validate the EO. I clear the property vector:
public void dontValidate() {
mRequiredProperties = new Vector();
}
=== So here goes my scenario: ===
1. I fetch the eo object through the nested ec
2. I change the object's properties
3. I decide not validate them, clear the mRequiredProperties vector
4. I save the EO
ctx.saveChanges();
session().defaultEditingContext().saveChanges();
=== Here's the problem: ===
I call saveChanges() twice. So validateProperty1 is called twice. First time
it is called from ctx.saveChanges() stack. Second time it called from
session().defaultEditingContext().saveChanges() stack.
When it's called the second time, validateProperty1 sees the original
mRequiredProperties. That means that it is not empty and tries to validate
the property1.
So how do I propagate mRequiredProperties's change from a child ec to the
default ec?
Any help is much appreciated
--
marius
The information transmitted in this E-mail is intended only for the person
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons other
than the intended recipient is prohibited. If you received this in error,
please contact the sender and delete the material from any computer.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.