Open mariussoutier opened 12 years ago
I'm looking into this problem now.
What editing context? MockEditingContext or TemporaryEditingContext?
I've written some tests and it worked with MockEditingContext. The TemporaryEditingContext didn't find any object, but it also didn't throw any exception.
I tried both, didn't work. Have you tried a Fetch Spec with a parameter?
Yes, I tried 3 scenarios:
Maybe I'm missing something? Does Incident or Patient inherit from other entity? What is the kind of relationship between them? To one? To many? Many-to-many?
To-many, a patient has many incidents, an incident has one patient. The spec looks like this: patient = $patient and incidentID = diagnoses.incidentID and (disabled = null or disabled = 'false')
Marius,
I've tried to reproduce the same entities and the same relationships in a test model. I'm still unable to reproduce the error on fetchIncidentsWithDiagnosesForPatient on both: MockEditingContext and TemporaryEditingContext.
The same fetchSpecification works in runtime with real editing contexts, right? Looking into the stack trace, it doesn't seem to be a WOUnit problem. :(
Hi, I have similor problem with a fetch specs defined in the EOModel.
My fetch does not return any results when I use MockEditingContext with relationship To many. But if I use ERXEC.newEditingContext() all is ok.
//@Rule
public MockEditingContext editingContext = new MockEditingContext("Core");
//public EOEditingContext editingContext2 = ERXEC.newEditingContext();
//@Dummy for one book many page
private Book _book;
//@Dummy
private Page _page;
@Test
public void testListeMembreValides() {
_book = Book.createBook(editingContext); //create
_book.setTitle("TestBook");
_page = Page.createPage(editingContext); //create
_page.setEmpty(true);
_book.addToRelationPage(_page); // this fonction call addObjectToBothSideOfRelationshipWithKey(objet, _book.ClefPages)
// This fetch is ok with the MockEditingContext and EOEditingContext
NSArray<? extends Book> listBook = Book.fetchBooks(editingContext, Book.QualTitle.contains("TestBook"), null, false);
assertFalse(listBook.count() == 0);
// This fetch fails with the MockEditingContext, but works with EOEditingContext
NSArray<? extends Book> listBook2 = Book.fetchBooks(editingContext, Book.QualTitle.contains("TestBook").and(Book.QualPages.dot(Page.QualEmpty).isTrue()), null, false);
assertFalse(listBook2.count() == 0);
}
I'm looking into this problem again.
It seems to be a problem in the qualifier evaluation algorithm provided by the core WebObjects classes. I'm writing to the list to ask for advice.
Thanks for your investigation. Let me know when you have solution.
Hello Henrique,
I was just wondering if there was a fix for this issue? It's definitely a blocker for our development team. Unless there is a workaround?
Thank you.
Martin
@syrinx2012 this issue is caused by a bug in the core WebObjects classes. Kieran Kelleher pushed a change to Wonder that I think is supposed to fix this problem or, at least, is related to the problem. You can see the change here:
https://github.com/wocommunity/wonder/commit/ea23f97a2d18455fba38d496e0ee348aee41b0c0
I still don't have a work around for this issue. However, I'll try to address this problem after WOWODC.
Thanks for the information. However, I'm already running version 6.0.4 of Wonder, which include this fix, and the problem still exist. I guess it's caused by something else. Thanks a lot for looking into this!
For your information, I will try to solve this issue this year.
Mathieu
Hello Henrique,
I found a solution. I need to put more effort on it to be sure it's a good solution. I will give you the fix when it's be ready.
note: The problem is in WebObjects and the fix is in Wonder.
Mathieu
Mathieu, nice to hear. Just let me know if you need any help.
In the EOModel I have a fetch spec defined with the qualifier $patient of type Patient. This auto-generates a method which does:
I then call it like this:
This does not work with WOUnit, the following exception gets thrown: