ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson Fortaleza" <afortal...@aridesa.com.br>
Subject Result lazyloaded but whole tree being selected
Date Thu, 26 Apr 2007 14:36:54 GMT
Hi, I have the following ResultMap:

    <resultMap id="rmSerie" class="Serie">
      <result property="SerieID" column="SerieID"/>
      <result property="Descricao" column="Descricao"/>
      <result property="Abreviacao" column="Abreviacao"/>
      <result property="Sigla" column="Sigla"/>
      <result property="Curso" column="CursoID" select="qryCursoPorID" lazyLoad="true"/>
      <result property="TurnoIntegral" column="TurnoIntegral"/>
    </resultMap>

And the following statement:

    <select id="qrySeriePorEmpresaID" resultMap="rmSerie" parameterClass="int">
      <![CDATA[
        SELECT DISTINCT Serie.SerieID, Serie.Descricao, Serie.Abreviacao, Serie.Sigla, Serie.CursoID,
Serie.TurnoIntegral
        FROM V_Serie Serie
         JOIN V_Curso Curso ON (Serie.CursoID = Curso.CursoID)
         JOIN V_Empresa Empresa ON (Curso.EmpresaID = Empresa.EmpresaID)
         JOIN V_Turma Turma ON (Turma.SerieID = Serie.SerieID)
         JOIN V_PeriodoLetivo PeriodoLetivo ON (Turma.PeriodoLetivoID = PeriodoLetivo.PeriodoLetivoID)
        WHERE Empresa.EmpresaID = #EmpresaID#
          AND Curso.TipoCurso = 'N'
          AND Ano = YEAR(GETDATE())
          AND TurnoIntegral = 0
        ORDER BY Serie.Sigla
      ]]>  
    </select>

I call the select statement in my code:

IList<Serie> SerieEmpresa = Mapper.Instance().QueryForList<Serie>("qrySeriePorEmpresaID",
ddlSede.SelectedItem.Value);
ddlSerie.DataSource = SerieEmpresa;
ddlSerie.DataBind();

I'm checking the queries requested in my SQL Server with Profiler and the select "qryCursoPorID"
lazyloaded on the result is executed (N + 1 problem is taking place), despite the lazyload
attribute. I don't use any Curso property or anything, actually checking the SerieEmpresa
object right after the filling of that object brings me the whole object tree.

Lazyloaded is being completly ignored. I'm using DataMapper 1.5.1. Am I doing something wrong
or fogetting something ?

thank you
Anderson Fortaleza
Mime
View raw message