ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno Silva (Cool Advance)" <bruno.si...@cooladvance.com>
Subject Re: SQL Fragments in iBATIS.NET / Connection pooling
Date Mon, 13 Nov 2006 18:08:08 GMT
This was the type of queries I used in Java. I had some conditions in 
the WHERE clause that were used in several filters.
I currently need something similar.

Correct me if I'm wrong but doesn't *extend* just append the text of the 
child statement to the text of the parent statement?




        resultMap="Encomenda.Select.Map" cacheModel="filtros-encomendas-cache">

        SELECT distinct enc.*, c.nome as nome_cliente, cond.descricao as desc_cond,

        date_part('year', enc.data_enc) * 10000 + enc.idano as numero_identificacao, c.distancia_km

        FROM encomendas enc

        INNER JOIN itemsencomendas i ON enc.id = i.id_encomenda

        INNER JOIN artigos a ON i.id_artigo = a.id

        INNER JOIN qualidades q ON a.id_qualidade = q.id

        INNER JOIN formas f ON q.id_forma = f.id

        INNER JOIN especies e ON a.id_especie = e.id

        INNER JOIN clientes c ON c.id = enc.id_cliente

        INNER JOIN condicoespagamento cond ON cond.id = enc.id_condicao_pagamento

        WHERE (anulado IS NULL or anulado = false)

        <dynamic prepend="AND">

            <include refid="Filtros.Vendas.Fragment"/>

            <include refid="Filtros.Cliente.Fragment"/>

            <include refid="Filtros.Especie.Fragment"/>

            <include refid="Filtros.Forma.Fragment"/>

            <include refid="Filtros.Confirmado.Fragment"/>

            <include refid="Filtros.Artigos.Fragment"/>


        ORDER BY a.id
        LIMIT 100


Gilles Bayon wrote:
> You could use the extends attribute on statement.It is mOO :-) and do 
> the same thing
> Indeed, I don't like very much the sql fragment...
> -- 
> Cheers,
> Gilles
> <a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE 
> <http://www.amazon.com/gp/registry/6JCP7AORB0LE>">Wish List</a> 

Cool Advance - Information Systems

View raw message