Skip to content

NH-3848 - Child collection fetched using left outer join with on clause or where clause restrictions on fetched collection shouldn’t be stored in second level cache. #1341

Closed
@nhibernate-bot

Description

@nhibernate-bot

Lukasz created an issue — 22nd February 2016, 11:36:30:

Reproductions Steps:

  1. Enable second level cache in nh configuration.
  2. Create entity with collection.
  3. Enable second level cache on collection (on collection entity also ofc).
  4. Open session.
  5. Create QueryOver (Criteria or HQL) which fetch root entities with children collections using left outer join with some restrictions on collection.
    E.g.
 firstSession.QueryOver<Customer>()
    .JoinAlias(n => n.Orders,
               () => ordersAlias,
               JoinType.LeftOuterJoin,
               Restrictions.Eq("Number", orderNumber))
    .List();
  1. Open another session.
  2. Create QueryOver on second session for all root entities. E.g.
secondSession.QueryOver<Customer>().List();
  1. Iterate over entities fetched in point 7. and fetch child collections.
  2. All collection fetched in point 8. Will be filtered like in point 5.

Lukasz added a comment — 23rd February 2016, 13:08:49:

Pull request with tests and fix for Criteria and QueryOver: #460


Lukasz added a comment — 24th February 2016, 14:01:27:

Pull request with tests and fix for HQL: #463


Alexander Zaytsev added a comment — 7th April 2017, 1:37:44:

<~Lukasz> your pull request(s) do not consider 2 separate fetches. When there is a collection with restrictions and another one without then I expect that the collection without restrictions would be cached.

So, the property "CanAddCollectionsToCache" shall probably be a dictionary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions