Hi, Jeff,

It's late and I don't have time to review your code carefully, but at a glance I saw nothing wrong.

Have you checked the value for "first" in the database? Is it possible that the value there is actually "first Jeff"?

Regards,
Jerry

On May 16, 2006, at 11:57 PM, Jeff Schmitz wrote:

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!


--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems

    [EMAIL PROTECTED]
    203 278-4085        office



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to