ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sahridhayan Ungal" <sahridha...@gmail.com>
Subject Re: Generic Lists
Date Fri, 13 Jul 2007 04:08:20 GMT
can you share with me the map file will look like for insert?

i am also held up with similar  (i.e cannot insert data from child class
property, for example if i refer #Person.OID# inside INSERT statement

i am using version
IBatisNet.DataMapper.dll - 1.5.1.0
IBatisNet.DataAccess.dll - 1.8.1.0

with .net 2.0 and SQL 2005 and VS2005

in win xp machinesp2

Thank you for any lights shown in this problem..

Sahridhayan





On 7/13/07, Nguyen, Tom <Tom.Nguyen@rels.info> wrote:
>
>   Woopse, that's not generic.  I wanted to simplify the code a little but
> then it turns out to be non-generic.  Here is the original code.
>
>
>
>     /// <summary>
>
>     /// Simplify Order Children class definition.
>
>     /// </summary>
>
>     [Serializable]
>
>     public class OrderChild<T> : BusinessBase
>
>     {
>
>         /// <summary>
>
>         /// Order
>
>         /// </summary>
>
>         protected EntityRef<Order, T> _order = new EntityRef<Order, T>();
>
>
>
>         /// <summary>
>
>         /// Get or sets Order
>
>         /// </summary>
>
>         public Order Order
>
>         {
>
>             get { return _order; }
>
>             set {
>
>                 object self = this; // update circular reference
>
>                 _order.UpdateValue(value, (T)self);
>
>             }
>
>         }
>
>     }
>
>
>
> public class OrderDeliveryAddress : OrderChild<OrderDeliveryAddress> { … }
>
>
>
> Regards,
>
>
> Tom Nguyen
> Sr. Developer
> tom.nguyen@rels.info
>
>  ------------------------------
>
> *From:* Nguyen, Tom [mailto:Tom.Nguyen@rels.info]
> *Sent:* Thursday, July 12, 2007 1:20 PM
> *To:* user-cs@ibatis.apache.org
> *Subject:* RE: Generic Lists
>
>
>
> I believe the latest one 1.6.1 has support for generic list.
>
>
>
> One thing I found is that it does not work for all generic definitions,
> similar to Tony.
>
>
>
> Example:
>
>
>
> // In this example, I'm using Generic to write less code.  Say Order's
> Child can access Order similar to how Asp.NET Page.Controls[0].Page etc…
>
>
>
> OrderChild
>
>     /// <summary>
>
>     /// Simplify Order Children class definition.
>
>     /// </summary>
>
>     [Serializable]
>
>     public class OrderChild : BusinessBase
>
>     {
>
>         /// <summary>
>
>         /// Order
>
>         /// </summary>
>
>         protected Order _order = new Order();
>
>
>
>         /// <summary>
>
>         /// Get or sets Order
>
>         /// </summary>
>
>         public Order Order
>
>         {
>
>             get { return _order; }
>
>             set {
>
>                 _order = value
>
>             }
>
>         }
>
>     }
>
> // Then I can do something like this
>
> public class OrderLoanInfo : OrderChild { … }
>
> public class OrderDeliveryAddress : OrderChild { … }
>
> // This confuse the DataMapper and it doesn't know what to do if say I do
> #_orderLoanInfo.Order.LoanNumber#
>
>
>
> I have to manually define the order object in every child class.
>
>
>
>
>
> Regards,
>
>
> Tom Nguyen
> Sr. Developer
> tom.nguyen@rels.info
>  ------------------------------
>
> *From:* Clough, Samuel (USPC.PRG.Atlanta) [mailto:
> Samuel_Clough@princetonrg.com]
> *Sent:* Thursday, July 12, 2007 12:36 PM
> *To:* user-cs@ibatis.apache.org
> *Subject:* RE: Generic Lists
>
>
>
> I'm probably not thinking clearly and haven't coded using iBatis in a
> while, but doesn't it support just the IList interface, not necessary any
> collection?  In this case you may be getting lucky with List<T> simply
> because that is the default implementation of IList<T>.  Of course, I could
> be way off so you may want to wait until the experts chime in...
>
>
>  ------------------------------
>
> *From:* Tony Johnson [mailto:listAccount@deepcode.co.uk]
> *Sent:* Thursday, July 12, 2007 1:20 PM
> *To:* user-cs@ibatis.apache.org
> *Subject:* Generic Lists
>
> Hi,
>
>
>
> I'm struggling with trying to get a custom generic list collection working
> with IBATIS lazy loading. Basically, if I have a simple object with a simple
> mapping file that lazy loads a list and that list is defined in my object as
> a List<T> then things work fine. Eg:
>
>
>
> class myobject
>
> {
>
> …
>
> public List<subobject> Children{get… set…}
>
> }
>
>
>
> But as soon as I introduce a new class to take over the list, eg:
>
>
>
> public class MyList<T> : List<T>
>
> {
>
> }
>
>
>
> And then change myobject to use that:
>
> class myobject
>
> {
>
> …
>
> public MyList<subobject> Children{get… set…}
>
> }
>
>
>
> IBATIS no longer lazy loads any data. I'm under the impression that any
> collection that implements IList or IList<T> will work transparently with
> lazy loading, yet the MyList<T> class above implements these (albeit in the
> base class) and it doesn't work.
>
>
>
> Am I doing something stupid here?
>
>
>
> Thanks
>
> Tony
>
>
>  ------------------------------
>
> *Princeton Retirement Group, Inc - Important Terms *
>
> This E-mail is not intended for distribution to, or use by, any person or
> entity in any location where such distribution or use would be contrary to
> law or regulation, or which would subject Princeton Retirement Group, Inc.
> or any affiliate to any registration requirement within such location.
>
> This E-mail may contain privileged or confidential information or may
> otherwise be protected by work product immunity or other legal rules. No
> confidentiality or privilege is waived or lost by any mistransmission.
> Access, copying or re-use of information by non-intended or non-authorized
> recipients is prohibited. If you are not an intended recipient of this
> E-mail, please notify the sender, delete it and do not read, act upon,
> print, disclose, copy, retain or redistribute any portion of this E-mail.
>
> The transmission and content of this E-mail cannot be guaranteed to be
> secure or error-free. Therefore, we cannot represent that the information in
> this E-mail is complete, accurate, uncorrupted, timely or free of viruses,
> and Princeton Retirement Group, Inc. cannot accept any liability for E-mails
> that have been altered in the course of delivery. Princeton Retirement
> Group, Inc. reserves the right to monitor, review and retain all electronic
> communications, including E-mail, traveling through its networks and systems
> (subject to and in accordance with local laws). If any of your details are
> incorrect or if you no longer wish to receive mailings such as this by
> E-mail please contact the sender by reply E-mail.
>  ------------------------------
>  ------------------------------
>
> This e-mail message and any files transmitted herewith, are intended
> solely for the use of the individual(s) addressed and may contain
> confidential, proprietary or privileged information.  If you are not the
> addressee indicated in this message (or responsible for delivery of this
> message to such person) you may not review, use, disclose or distribute this
> message or any files transmitted herewith.  If you receive this message in
> error, please contact the sender by reply e-mail and delete this message and
> all copies of it from your system.
>  ------------------------------
>
> ------------------------------
>
> This e-mail message and any files transmitted herewith, are intended
> solely for the use of the individual(s) addressed and may contain
> confidential, proprietary or privileged information.  If you are not the
> addressee indicated in this message (or responsible for delivery of this
> message to such person) you may not review, use, disclose or distribute this
> message or any files transmitted herewith.  If you receive this message in
> error, please contact the sender by reply e-mail and delete this message and
> all copies of it from your system.
>
> ------------------------------
>
>

Mime
View raw message