|
From: Fabio M. (JIRA) <nh...@gm...> - 2011-04-22 19:54:45
|
[ http://216.121.112.228/browse/NH-2666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20945#action_20945 ]
Fabio Maulo commented on NH-2666:
---------------------------------
If you see the resolution of NH-1583 it is Open
> CLONE -many-to-one with property-ref makes separate select always
> -----------------------------------------------------------------
>
> Key: NH-2666
> URL: http://216.121.112.228/browse/NH-2666
> Project: NHibernate
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.1.GA
> Reporter: Onur Gumus
> Priority: Major
>
> I have following tables:
> - transactions:
> - id (autogenerated in database); PK;
> - numcode, for example 840 - numeric currency code;
> - other columns
> - currencies:
> - id - PK, autogenerated;
> - numcode - unique key
> - alphacode (for example USD)
> - decnum;
> - fullname;
> and mapping for transactions table:
> <many-to-one name="numcode" column="numcode" property-ref="numcode" />
> When I'm retrieving transactions NHibernate generates a separate select for currencies table for each row from transactions table. This is very inefficient (N+1 problem).
> Solution is to do eager fetching. After specyfying eager fetching I see that transactions and currencies tables are joined, which means that I'm doing that right. However separate additional fetch in currencies is still occuring for each row in transactions table.
> I've tried both criteria API and HQL.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|