Re: Getting complex queries in cayenne

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon May 09 2005 - 21:32:05 EDT

  • Next message: Andrus Adamchik: "Re: Getting complex queries in cayenne"

    Sami,

    I can't comment on the JSP code, but as far as Cayenne code goes, I
    suspect you might be getting the same problem as Denna used to hit
    before, i.e. the data returned from the query can not be mapped to a
    DataObject, so an invalid DataObject is created. In your case I really
    don't see why you need to use a SQLTemplate anyway. Just use a regular
    SelectQuery and you should do fine.

    ... In the meantime let me see what can be done about preventing this
    SQLTemplate behavior (i.e. quietly creating invalid DataObjects when DB
    results are not comprehensible). Ideally it should throw an
    exception...

    Andrus

    On May 9, 2005, at 3:34 PM, Sami Mohammed wrote:
    > I also have the same problem. when i tried using the method which
    > andrus wrote in his last mail, but on the jsp page it is retriving
    > number of rows, but not displaying content
    > what I am doing wrong pls let me know.
    > How to display result on jsp. O r i have to use another method.
    >
    >
    > DataContext context =
    > BasicServletConfiguration.getDefaultContext(request...getSession());
    > String sql = "select"
    > + " #result('u.USR_ID' 'String'),"
    > + " #result('u.LAST_NAME' 'String'),"
    > + " #result('t.SECURITY_SHORT_DESC' 'String'),"
    > + " #result('u.LAST_LOGIN_DATE' 'java.util.Date')"
    > + " from IHA.EDW_DATA_MGMT_SECURITY_MSTR t,"
    > + "IHA.EDW_DATA_MGMT_SECURITY_USR u"
    > + " where t.security_mstr_key=u.security_mstr_key";
    >
    > // get list of users
    >
    > SQLTemplate query = new SQLTemplate(EdwDataMgmtSecurityUsr.class,
    > sql, true);
    > //query.setTemplate(DbAdapter.ORACLE,sql);
    > List resultList = context.performQuery(query);
    >
    > if (!resultList.isEmpty())
    > {
    > // Store the results into the session object
    > request.getSession().setAttribute("DisplayResult", resultList);
    > }
    > }
    >



    This archive was generated by hypermail 2.0.0 : Mon May 09 2005 - 21:32:09 EDT