|
From: Onur G. (JIRA) <nh...@gm...> - 2011-04-22 19:44:56
|
[ http://216.121.112.228/browse/NH-2666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20942#action_20942 ]
Onur Gumus commented on NH-2666:
--------------------------------
If you read the comments on the other issue, it seemed to be fixed. Maybe this is a regression. I was just going to update that issue for affected versions but couldnt do it.
> 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
|