I'm currently using classes that inherit from EOGenericRecord for
my enterprise objects. When I retrieve a string value from one of
the functions in an EO class directly, things work fine. However,
when I follow a relationship to call a function on a related
enterprise object, both the key and the value are concantenated
into a string that is returned from the function. Why am I
getting the key as part of the string? Below is an example call
that I'm making.
System.out.println(((EOEntries)entryList.objectAtIndex(0)).user
().first());
This prints out (for example) "first Jeff" instead of just "Jeff"
Below are my edited EO classes showing the pertinent functions:
import com.webobjects.foundation.*;
import com.webobjects.eocontrol.*;
import java.math.BigDecimal;
import java.util.*;
public class EOEntries extends EOGenericRecord {
public EOEntries() {
super();
}
public String name() {
return (String)storedValueForKey("name");
}
public EOUser user() {
return (EOUser)storedValueForKey("user");
}
}
// EOUser.java
// Created on Thu May 11 21:37:37 US/Central 2006 by Apple
EOModeler Version 5.2
import com.webobjects.foundation.*;
import com.webobjects.eocontrol.*;
import java.math.BigDecimal;
import java.util.*;
public class EOUser extends EOGenericRecord {
public EOUser() {
super();
}
public String first() {
return (String)storedValueForKey("first");
}
public NSArray entries() {
return (NSArray)storedValueForKey("entries");
}
public void setEntries(NSArray value) {
takeStoredValueForKey(value, "entries");
}
public void addToEntries(EOEntries object) {
includeObjectIntoPropertyWithKey(object, "entries");
}
public void removeFromEntries(EOEntries object) {
excludeObjectFromPropertyWithKey(object, "entries");
}
}
Thanks,
http://www.netbrackets.com - nothin' but net!