Skip to content

NH-1200 - Exception occurs when using criteria exist queries #780

Closed
@nhibernate-bot

Description

@nhibernate-bot

Tomer Avissar created an issue — 13th November 2007, 8:34:03:

Exception occurs when using criteria exist queries

When using a Criteria query with Exist with subquery, a QueryException is raised. The exception is handled, quoting the remark:

//not found in inner query , try the outer query

The query executes successfully, but causes a significant performance overhead because of the exception.

This can easily be reproduced, for example:

DetachedCriteria dc = DetachedCriteria.For(typeof(Employee))
     .SetProjection(Projections.Id())
     .Add(Expression.Eq("FirstName", "David"))
     .Add(Property.ForName("Department.Id").EqProperty("department.Id"));

IList<Department> departments =
     session.CreateCriteria(typeof(Department), "department")
     .Add(Subqueries.Exists(dc))
     .List<Department>();

Karl Chu added a comment — 22nd April 2008, 16:45:06:

Changing this to "improvement" as it behaves correctly... albeit a little slow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions