Skip to content

NH-3806 - Saving entities with proxy associations leads to fetching associated entities #1338

Closed
@nhibernate-bot

Description

@nhibernate-bot

Serhiy Shekhovtsov created an issue — 6th July 2015, 9:26:51:

During batch saving the method IsProcessedAfterAllAssociatedEntities is called and it calls GetHashCode of the associated Entity. At this moment DefaultLazyInitializer intercepts the call and fires ImmediateLoad for the associated proxy entity, which leads to entity fetching.
More details here.


Serhiy Shekhovtsov added a comment — 7th July 2015, 12:03:44:

As I figured out this is not related to batching and can be reproduced with a simplest example.


Serhiy Shekhovtsov added a comment — 8th July 2015, 9:23:15:

Complete and very basic sample can be downloaded here.


Summarizing it:

When using entities which do override the GetHashCode and Equals implementation, and use an identifier generator which does not trigger an immediate flush, saving many entities associated to uninitialized proxies causes the proxies to be loaded.
This reduces the usefulness of ISession.Load.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions