I have D2W application where we have a to-many relationship. This relationship 
is displayed by a custom component. The user can check the desired destination 
objects (there are only 5 available). It is required that at least one checkbox 
must be ticked. In the EOModel the to-many relationship is set to not null.

Default handling (validateForSave) returns an exception text "The relationship 
must have at least one assignment of type ?". Obviously EOF is not able to 
figure what the destination is and displays a question mark. I tried to 
implement validateIndustryProducts() but this method is never called. 
Overriding validateForSave and NOT calling super.validateForSave works but this 
does not feel right. How can I validate that relationship properly?

Model Details: There is a qualified many-to-many relationship between a product 
and an industry. A product must be assigned to at least one of the 5 
industries. For each assignment the user must give a free text primary use for 
that product in that assigned industry. The qualified join entity is called 
IndustryProduct and thus the relationship on product is called 
industryProducts. Here is my code from Product that does not get called:

        public Object validateIndustryProducts(Object value) throws 
ValidationException {
                if (industryProducts() == null || 
((NSArray)industryProducts()).count() == 0) {
                        throw new ValidationException( "At least 1 industry 
must be assigned" );
                }
                return value;
        }

What do I miss?

Thanks a lot
---markus---





Markus Ruggiero
[email protected]
Check out the new book about Project Wonder and WebObjects on 
http://learningthewonders.com







 _______________________________________________
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]

Reply via email to