cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: SQLTemplate - multiple statements
Date Mon, 03 Mar 2008 12:40:42 GMT
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
>
>


Mime
View raw message