ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles Bayon (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATISNET-263) Support for circular reference
Date Sun, 18 May 2008 06:27:55 GMT
Support for circular reference

                 Key: IBATISNET-263
                 URL: https://issues.apache.org/jira/browse/IBATISNET-263
             Project: iBatis for .NET
          Issue Type: Improvement
          Components: DataMapper
    Affects Versions: DataMapper 3.0
            Reporter: Gilles Bayon
            Assignee: Gilles Bayon
            Priority: Minor
             Fix For: DataMapper 3.0

To avoid creation of new Instance of the same object during an ibatis request, add the 'keys'
attribute on resultMap tag to specify the properties identifiers

public class Order
	public Account {get;set}

<resultMap id="account-constructor-circular" keys="identifiant"  class="Account" >
		<argument argumentName="identifiant"	column="Account_ID"/>
		<argument argumentName="firstName"    column="Account_FirstName"/>
		<argument argumentName="lastName"     column="Account_LastName"/>

<resultMap id="order-result-circular" extends="base-order-result" class="Order">
	<result property="Account" resultMapping="Account.account-constructor-circular"/>

<select id="GetOrderWithAcccount" resultMap="order-result-circular" >
  Orders o
  Accounts a
  o.Account_Id = A.Account_Id

List<Order> list = (List<Order>)dataMapper.QueryForList<Order>("GetOrderWithAcccount",

Account account1 = list.Find(delegate(Order order) { return order.Id==1; }).Account;
Account account2 = list.Find(delegate(Order order) { return order.Id == 10; }).Account;

Assert.That(account1, Is.SameAs(account2));

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message