Re: executing raw sql

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu May 08 2003 - 10:21:17 EDT

  • Next message: Lonnie Matsuno: "BLOB Insertions"

    Hi Martin,

    > I tried:
    > SqlSelectQuery kpiscoresquery = new SqlSelectQuery();
    > kpiscoresquery.setSqlString("select distinct a.* from cm_user_kpi a,
    > tmp_cm_user_kpi b WHERE a.kpi_id = b.kpi_id and a.valuta_timestamp =
    > b.valuta_timestamp order by kpi_value desc");
    > ctxt.performQuery(kpiscoresquery, new ScoreQueryObserver(this));
    > I get the error:
    > org.objectstyle.cayenne.CayenneRuntimeException: Could not find DbEntity
    > for query with root :null

    > but which one should be the root?
    > cm_user_kpi or tmp_cm_user_kpi

    The answer is - it can be any of the above. In case of raw SQL queries,
    root is used merely as a routing hint to Cayenne to find the right
    DataNode. I assume you have a single DataNode. In this case, to make it
    easier, you can use any Java class referenced in your DataMap, even if it
    is not related to your query contents.

    Andrus



    This archive was generated by hypermail 2.0.0 : Thu May 08 2003 - 10:21:17 EDT