Duplicate records using Future()

Description

.Net 3.5 SP1, SQL Server 2005 dialect, with 3.3.2 GA source

Join-fetching a collection using Future() produces duplicate records if the collection is affected by multiple queries. The problem seems to be that all multiple queries are executed at once and the multi query just keeps adding all the records from different queries into the same collection.

For example, if a statement like this -

session.CreateQuery("from Person p left join fetch p.Children where pp.Id = 1").Future<Person>();

  • is executed three times, after the query is run the p.Children collection will contain triple the number of child records. Using List() instead of Future() loads the child records properly.

The problem seems to depend on the child record having a many-to-one relation: remove this and everything seems to work correctly.

I've attached a test case: add these two files to the NHibernate.Test\NHSpecificTest\Futures folder and run the supplied test to see the issue.

Environment

None

Attachments

2

Activity

Show:
Frédéric Delaporte
June 24, 2018 at 4:52 PM

Moved here.

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created December 8, 2012 at 12:31 PM
Updated June 24, 2018 at 4:52 PM
Resolved June 24, 2018 at 4:52 PM
Who's Looking?