I have a component that I am updating a table of answers based on selections made by the user from a worepitition.
try {
String sEoQualifierText = "page=";
sEoQualifierText += Integer.toString((Integer)thePage().valueForKey("identifier"));
sEoQualifierText += " and question=";
sEoQualifierText += Integer.toString((Integer)theQuestion().valueForKey("identifier"));
sEoQualifierText += " and user=";
sEoQualifierText += Integer.toString((Integer)((EOEnterpriseObject)theUser).valueForKey("identifier"));
EOQualifier oQual = EOQualifier.qualifierWithQualifierFormat(sEoQualifierText,null);
EOFetchSpecification oFetch = new EOFetchSpecification("UserAnswers",oQual,null);
NSArray aAnswer = oEO().objectsWithFetchSpecification(oFetch);
oEO().lock();
((UserAnswers)aAnswer.objectAtIndex(0)).setTheAnswer((QuestionLookup)theAnswer());
//((EOEnterpriseObject)aAnswer.objectAtIndex(0)).willChange();
oEO().unlock();
//System.out.println("updates to be saved: " + oEO().updatedObjects());
oEO().saveChanges();
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
System.out.println("hissssss, didn't work");
}
if (theAnswer!=null) {
System.out.println("append to response firing "+(String)theAnswer.valueForKey("desc"));
} else {
System.out.println("append to response firing but the answer is null");
}
ThePage is an item from a listing of available pages repetition.
TheQuestion is an item from listing of questions repitition.
TheUser is the user who is currently working with the page.
The entity has 4 attributes (user, page, question, answer).
When I turn on EO Debugging I see that an update is made, but when I check the database the answer is always null. I do not get any errors in the logs. If I had an error I could start working it out.
Anyone have any ideas?
Thanks
Don