cayenne postgres view problem?

From: martin ruff (mruf..imeon.ch)
Date: Sat Mar 15 2003 - 07:24:24 EST

  • Next message: Dirk Olmes: "Re: cayenne postgres view problem?"

    Hi I have a view and the follwing code:
                    SelectQuery query = new SelectQuery("WochenrapportFieldsString");
                    //query.addOrdering("reportingdate", false);
                    reportings = theDataContext.performQuery(query);

    Now I have the problem that every list entry of my 3848 returned objects
    contains the SAME object
    (database row result)

    with a raw query: SqlSelectQuery rawqery = new
    SqlSelectQuery(WochenrapportFieldsString.class, "SELECT * FROM
    wochenrapport_fields_string");

    it works fine I get all my 3848 DIFFERNET objects from my view

    I have no idea what could be wrong

    here's my datamap followed by my view ddl

            <db-entity name="wochenrapport_fields_string">
                    <db-attribute name="importstring" type="VARCHAR" length="5000"/>
                    <db-attribute name="reportingdate" type="DATE"/>
            </db-entity>
            <obj-entity name="WochenrapportFieldsString"
    className="com.infometis.reporting.db.cayenne.WochenrapportFieldsString"
    dbEntityName="wochenrapport_fields_string">
                    <obj-attribute name="importstring" type="java.lang.String"
    db-attribute-name="importstring"/>
                    <obj-attribute name="reportingdate" type="java.sql.Date"
    db-attribute-name="reportingdate"/>
            </obj-entity>
    CREATE VIEW wochenrapport_fields_string (
            reportingdate,
        importstring
         )
    AS
    SELECT
       E.REPORTINGDATE,
        TO_CHAR(G.ID, '9999999999') || '{#}' || G.NAME || '{#}' || TO_CHAR(
    E.REPORTINGDATE, 'DD.MM.YYYY' ) || '{#}' || A.NAME || '{#}"' ||
    F.DESCRIPTION
       || '"{#}' || TO_CHAR(F.HOURS, '9999') || '{#}' ||
    TO_CHAR(G.INVOICABLE, '9') || '{#}' || C.SHORTNAME || '{#}' ||
    TO_CHAR(F.INVOICED, '9999999999') || '{#}' || TO_CHAR(F.HOURS * B.RATE,
    '999999D99') as IMPORTSTRING
    FROM
        PROJECTS C
      , TASKS G
      , RATES B
      , REPORTINGDATES E
      , REPORTINGS F
      , EMPLOYEES A
    WHERE
       (B.EMPLOYEEID = A.ID)
      AND (B.PROJECTID = C.ID)
      AND (E.FK_EMPLOYEEID = A.ID)
      AND (F.FK_REPORTINGDATEID = E.ID)
      AND (F.FK_TASKID = G.ID)
      AND (G.FK_PROJECTID = C.ID)
      AND F.INVOICED = 0;



    This archive was generated by hypermail 2.0.0 : Sat Mar 15 2003 - 07:25:36 EST