RE: Cayenne returning a resultset?

From: Twan Kogels (twa..wansoft.com)
Date: Wed Nov 10 2004 - 03:41:44 EST

  • Next message: Jorge Sopena: "Problems rolling back flattened inserts"

    Hello Mike and Gary,

    Thanks for the reply. Your solution works perfect, i always thought that a
    valid object with valid fields had to be passed along the first parameter
    of SQLTemplate . But when you call setFetchingDataRows(true) the object
    fields doesn't get filled in with the database values, instead a List of
    Map/DataRow's is returned. Thats perfects! ;-)

    Cheers,
    Twan

    At 23:58 09-11-2004, you wrote:
    >As far as I know you can use SQL template with any arbitrary but valid SQL
    >string. The docs at
    >http://www.objectstyle.org/cayenne/userguide/fetch/sqltemplate.html
    >Have an example like:
    >
    >SQLTemplate selectQuery = new SQLTemplate(Artist.class, "select * from
    >ARTIST", true);
    >
    >Basically the Artist.class is only used to tell Cayenne how to connect to
    >the correct database, and does not have relation to the actual SQL String.
    >
    >So basically the call to dataContext.performQuery(selectQuery); should
    >return a list of datarows retrieved by the actual SQL string and not the
    >Artist.class parameter.
    >
    >Once again correct me if I'm wrong, but I'm pretty sure this works.
    >
    >- Gary
    >
    >
    >-----Original Message-----
    >From: Twan Kogels [mailto:twa..wansoft.com]
    >Sent: Wednesday, November 10, 2004 7:37 AM
    >To: cayenne-use..bjectstyle.org
    >Subject: Cayenne returning a resultset?
    >
    >Hello all,
    >
    >Maybe i have over looked the solution in the documentation, but i can't
    >seem to find a solution for the following problem, which is kind of simple.
    >
    >I've got a sql query which results in 2 fields which are not part of any
    >object in my datamap.
    >
    >select name, stat from user
    >
    >Without using cayenne i do above query with JDBC (connection, prepared
    >statement, resultset) directly and extract the row values from the
    >resultset.
    >
    >I've looked at SQLTemplate and SelectQuery but they all require a object
    >which is in the datamap.
    >
    >Is there a nice way to make cayenne do a query and retrieve the row value's
    >in a manner without using a object. Or should i just use JDBC and directly
    >access the database.
    >
    >Kind regards,
    >Twan Kogels



    This archive was generated by hypermail 2.0.0 : Wed Nov 10 2004 - 03:39:54 EST