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"/>

And the following statement:

    <select id="qrySeriePorEmpresaID" resultMap="rmSerie" parameterClass="int">
        SELECT DISTINCT Serie.SerieID, Serie.Descricao, Serie.Abreviacao, Serie.Sigla, Serie.CursoID,
        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

I call the select statement in my code:

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

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
View raw message