Hi,

I am currently using DataMapper 1.6.1 and lazy load works great. 

One example:

1) result Map for object Lotto containing a 1-to-many relationship mapped in my 
domain with a List<Cantina> 

<result property="Cantine" column="Id" select="SelectCantinaByLottoId" 
lazyLoad="true"/>

Stupid question: did you specified a resultMap *not* a resultClass in the 
select statement? 

<!--Wrong version lazy load not involved -->
<select id="SelectLottoById" parameterClass="string" resultClass="Lotto">
   <include refid="SelectLotto_BaseSQL" />
   <dynamic prepend="WHERE">
      <isParameterPresent>Id = #value#</isParameterPresent>
   </dynamic>
</select>

<!--Correct version lazy load fired -->
<select id="SelectLottoById" parameterClass="string" resultMap="LottoResMap">
   <include refid="SelectLotto_BaseSQL" />
   <dynamic prepend="WHERE">
      <isParameterPresent>Id = #value#</isParameterPresent>
   </dynamic>
</select>


Hope this helps

Andrea

At 10.38 24/10/2007, Sandy Young wrote:

>When I use DataMapper-1.6.1 instead of DataMapper-1.5.1, I find the lazyload 
>function doesn't work.
> If I replace DataMapper-1.6.1 with older DataMapper-1.5.1, it works.
> I find this bug is reported as a bug in <http://ibatis.net>ibatis.net's Issue 
> Tracker. 
>Is there anybody can fix it?
>Thank you!
>
>My code:
>
>IRegDao dao = new RegDao();
>            Reg reg = dao.Find(1);
>            Console.WriteLine("Reg:"); 
>            Console.WriteLine("SeqId:{0}", reg.SeqId);
>            Console.WriteLine("SubjID:{0}\tName:{1}", reg.SubjID, 
> <http://reg.Subj.Name>reg.Subj.Name);          
>
>///class Reg 
>public partial class Reg
>    {
>        #region Private Member        
>        private int? _SubjID;        
>        #endregion
>        
>        #region Private Extend Member        
>        private Subj _Subj; 
>        #endregion
>        
>        #region Constructor
>        public Reg()
>        {
>        }
>        #endregion
>        
>        #region Public Properties        
>        public int? SubjID 
>        {
>            get {return _SubjID;}
>            set {_SubjID = value;}
>        }        
>        #endregion
>        
>        #region Public Extend Properties        
>        public virtual Subj Subj 
>        {
>            get { return _Subj; }
>            set { _Subj = value; }
>        }
>        #endregion
>    }
>
>
>No virus found in this incoming message.
>Checked by AVG Free Edition. 
>Version: 7.5.503 / Virus Database: 269.15.8/1089 - Release Date: 23/10/2007 
>19.39

Reply via email to