Skip to content

NH-3350 - Duplicate records using Future() #1293

Closed
@nhibernate-bot

Description

@nhibernate-bot

Boris Drajer created an issue — 8th December 2012, 12:31:52:

.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();

  • 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions