Re: SQLTemplate - multiple statements

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Mar 03 2008 - 07:40:42 EST

  • Next message: Dave Merrin: "Re: SQLTemplate - multiple statements"

    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:41:15 EST