Hi,
I'm still trying to find out why my generated classes using VelocityEOGenerator aren't correct. There's only one error left. I'm using WO5.3 with latest WOLips and Mike's Velocity templates.
I have a Customer entity and a MailingCategory entity joined in a toMany relationship.
In the flattened relationship _MailingCategoryCustomer.java, everything is correct.
but there is one method in both _Customer.java and _MailingCategory.java which has an error:
the template generates the following method:
------------- in _Customer.java public NSArray<MailingCategoryCustomer> mailingCategoryCustomers(EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings, boolean fetch) { NSArray<MailingCategoryCustomer> results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = new EOKeyValueQualifier(MailingCategoryCustomer.CUSTOMER_KEY, EOQualifier.QualifierOperatorEqual, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { NSMutableArray qualifiers = new NSMutableArray(); qualifiers.addObject(qualifier); qualifiers.addObject(inverseQualifier); fullQualifier = new EOAndQualifier(qualifiers); } results = MailingCategoryCustomer.fetchMailingCategoryCustomers(editingContext(), fullQualifier, sortOrderings); } else { results = mailingCategoryCustomers(); if (qualifier != null) { results = (NSArray<MailingCategoryCustomer>)EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray<MailingCategoryCustomer>)EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; } and ----------- in _MailingCategory.java public NSArray<MailingCategoryCustomer> mailingCategoryCustomers(EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings, boolean fetch) { NSArray<MailingCategoryCustomer> results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = new EOKeyValueQualifier(MailingCategoryCustomer.MAILING_CATEGORY_KEY, EOQualifier.QualifierOperatorEqual, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { NSMutableArray qualifiers = new NSMutableArray(); qualifiers.addObject(qualifier); qualifiers.addObject(inverseQualifier); fullQualifier = new EOAndQualifier(qualifiers); } results = MailingCategoryCustomer.fetchMailingCategoryCustomers(editingContext(), fullQualifier, sortOrderings); } else { results = mailingCategoryCustomers(); if (qualifier != null) { results = (NSArray<MailingCategoryCustomer>)EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray<MailingCategoryCustomer>)EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; }
but there's no MailingCategoryCustomer.MAILING_CATEGORY_KEY nor MailingCategoryCustomer.CUSTOMER_KEY in MailingCategoryCustomer
MailingCategoryCustomer is a manyToMany join table.
There's a flattened mailingCategories method from Customer and a customers method from MailingCategory which is "instantiated" in EntityModeler.
It seems these method shouldn't be generated has there's already the flattened relationships: mailingCategories() in Customer and customers() in MailingCategory.
Anyone one with an idea?
Thanks,
Xavier |