You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org> on 2008/05/18 08:47:55 UTC
[jira] Closed: (IBATISNET-263) Support for circular reference
[ https://issues.apache.org/jira/browse/IBATISNET-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gilles Bayon closed IBATISNET-263.
----------------------------------
Resolution: Fixed
in SVN
> 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" >
> <constructor>
> <argument argumentName="identifiant" column="Account_ID"/>
> <argument argumentName="firstName" column="Account_FirstName"/>
> <argument argumentName="lastName" column="Account_LastName"/>
> </constructor>
> </resultMap>
> <resultMap id="order-result-circular" extends="base-order-result" class="Order">
> <result property="Account" resultMapping="Account.account-constructor-circular"/>
> </resultMap>
> <select id="GetOrderWithAcccount" resultMap="order-result-circular" >
> SELECT
> *
> FROM
> Orders o
> JOIN
> Accounts a
> ON
> o.Account_Id = A.Account_Id
> </select>
> List<Order> list = (List<Order>)dataMapper.QueryForList<Order>("GetOrderWithAcccount", null);
> 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.