Re: SQLTemplate - multiple statements

From: Dave Merrin (dmerri..pasystems.co.uk)
Date: Mon Mar 03 2008 - 07:48:57 EST

  • Next message: Ted Moens: "Queries"

    Cheers for that Andrus (and for the previous help on deletes). The
    single transaction is the bit I wanted. Will give it a try,

    Dave

    Andrus Adamchik wrote:
    > No (although a SQLTemplate created in the API supports multiple sets
    > of parameters that are applied to the same template).
    >
    > If you need multiple queries to appear as a single query (and run in
    > the same transaction with default Cayenne transaction settings), you
    > can use a QueryChain:
    >
    > http://cayenne.apache.org/doc/querychain.html
    >
    > Andrus
    >
    > On Mar 3, 2008, at 2:30 PM, Dave Merrin wrote:
    >
    >> Hi,
    >>
    >> is it possible to have multiple sql statments in the one SQLTemplate?
    >>
    >> e.g.
    >>
    >> <query name="PurgeItemByRootNodeId"
    >> factory="org.apache.cayenne.map.SQLTemplateBuilder" root="data-map"
    >> root-name="Untitled">
    >> <property name="cayenne.GenericSelectQuery.fetchingDataRows"
    >> value="true"/>
    >> <sql>
    >> <![CDATA[
    >> DELETE item
    >> FROM item, item_node
    >> WHERE item.item_id = item_node.item_id
    >> AND item_node.item_node_id = $root_node_id;
    >> ]]>
    >> </sql>
    >> <sql>
    >> <![CDATA[
    >> DELETE
    >> FROM item_node
    >> WHERE item_node.item_node_id = $root_node_id;
    >> ]]>
    >> </sql>
    >> </query>
    >>
    >> Cheers,
    >>
    >> Dave
    >>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Mar 03 2008 - 07:51:23 EST