Re: SQLTemplate with addPrefetch?

From: Twan Kogels (twa..wansoft.com)
Date: Thu Aug 26 2004 - 03:03:00 EDT

  • Next message: Twan Kogels: "Re: SQLTemplate with addPrefetch?"

    Andrus,

    Thanks! That's a good way to start a new day ;-) I'll get the nightly in a
    minute.

    Cheers,
    Twan

    At 15:41 25-8-2004, you wrote:
    >Twan,
    >
    >This is a bug in PrefetchHelper. As the fix was trivial (changing
    >"readPropertyDirectly" to "readProperty"), I applied it, and there is no
    >need to open a bug report. Fix should be included in tomorrow's nightly build.
    >
    >Andrus
    >
    >
    >On Aug 25, 2004, at 5:42 AM, Twan Kogels wrote:
    >
    >>Hello all,
    >>
    >>I did some more research and discovered the following:
    >>===========
    >>(in PrefetchHelper.java resolveToOneRelations() )
    >> List oids = new ArrayList(nobjects);
    >>
    >> for (int i = 0; i < nobjects; i++) {
    >> DataObject sourceObject = (DataObject) objects.get(i);
    >> DataObject targetObject =
    >> (DataObject) sourceObject.readPropertyDirectly(relName);
    >>
    >> ObjectId oid = targetObject.getObjectId();
    >> oids.add(oid);
    >> }
    >>===========
    >>
    >>The "(DataObject) sourceObject.readPropertyDirectly(relName);" causes the
    >>ClassCastException because the Object the readPropertyDirectly returns is
    >>of type:
    >>===========
    >>class org.objectstyle.cayenne.Fault$ToOneFault -
    >>org.objectstyle.cayenne.Fault$ToOneFaul..779885
    >>===========
    >>
    >>Because Fault isn't a subclass (or implements interface) of DataObject
    >>the casting generates a "ClassCastException".
    >>
    >>I'm currently using "cayenne-1.1B2".
    >>
    >>Cheers,
    >>Twan
    >



    This archive was generated by hypermail 2.0.0 : Thu Aug 26 2004 - 03:01:00 EDT