Help: Hollow class

From: Steve Wells (
Date: Mon Feb 02 2004 - 00:47:21 EST

  • Next message: Andrus Adamchik: "Re: Help: Hollow class"

    Hey group,

    I'm quite new to Cayenne so forgive me on any terminology.
    I'm trying to use cayenne-1.0.6 with Tomcat 4.1.29, mysql 4.0.16
    (connector java 3.0.10).

    Basically my problem is that I can't fetch objects related to some

    My datamodel is basically a 1 to many:
    Whitelist (a list of valid email suffixs for an Org) - The many side
            <db-entity name="whitelist" catalog="lgo">
                    <db-attribute name="emailSuffix" type="VARCHAR" isMandatory="true" length="120"/>
                    <db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="11"/>
                    <db-attribute name="orgName" type="VARCHAR" isMandatory="true" length="20"/>

    Org - An organisation - the one side
            <db-entity name="org" catalog="lgo">
                    <db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="11"/>
                    <db-attribute name="shortName" type="VARCHAR" isMandatory="true" length="20"/>

    The relationships:
            <db-relationship name="toOrg" source="whitelist" target="org" toDependentPK="false" toMany="false">
                    <db-attribute-pair source="orgName" target="shortName"/>
            <db-relationship name="toWhitelist" source="org" target="whitelist" toDependentPK="false" toMany="true">
                    <db-attribute-pair source="shortName" target="orgName"/>
            <obj-relationship name="toOrg" source="Whitelist" target="Org" toMany="false">
                    <db-relationship-ref source="whitelist" target="org" name="toOrg"/>
            <obj-relationship name="toWhitelist" source="Org" target="Whitelist" toMany="true">
                    <db-relationship-ref source="org" target="whitelist" name="toWhitelist"/>

    Java code (note the comments):
                SelectQuery qry = new SelectQuery(
                List results = dataCtx.performQuery(qry);

                Whitelist wl = (Whitelist) results.get(0);
                // This prints out results as expected
                context.log("WL: " + wl.getEmailSuffix() + ", " +

                // Cayenne INFO log prints out these msgs twice for some
                // "....will run 1 query.", "select .. from Org ...
                shortName = ? [bind: 'test']" and "returns 1 row" (correct
                there should be 1 row)
                Org o = wl.getToOrg();
                // prints out "Org: {[]<oid: Org: <shortName: test>; state:
                hollow>}" ...fair enough
                context.log("Org obj: " + o + ": " + o.getOrgKey());

                // Prints out "null", but from what I've read this should
                fetch the complete object first?
                context.log("Org name: " + o.getName());

    I just can't see where I've screwed up, can anyone pls help. And sorry
    for the huge dump of info. :)

    Also note that I can do this (and yield correct results):
    SELECT *
    FROM whitelist w
    inner join Org o on o.shortName = w.orgName
    where w.emailSuffix = ""



    -- - The way an email service should be

    This archive was generated by hypermail 2.0.0 : Mon Feb 02 2004 - 00:47:23 EST