SubqueryExpression don't support Dialect with VariableLimit

Description

If the dialect supports variable limit SubqueryExpression don't bind pagination parameters.

Environment

None

Activity

Show:

Julian Maughan August 10, 2010 at 10:19 AM

I have modified the MSSQL2005 dialect to support parameterized subquery 'paging'. Richard Brown deserves most of the credit for getting the parameter indexing issues sorted out. Committed to trunk as Rev. 5135.

Nikita: Please see https://nhibernate.jira.com/browse/NH-2258#icft=NH-2258 for my comments regarding your test.

Nikita Govorov August 6, 2010 at 2:14 PM

Some corrections:
var result = session.CreateCriteria(typeof(Student))
.Add(Subqueries.PropertyIn("Name", dc))
.List();

Nikita Govorov July 30, 2010 at 12:50 AM

I think this test should also pass:
[Test]
public void AllowToSetOffsetOnSubqueries()
{
using (ISession session = OpenSession())
using (ITransaction t = session.BeginTransaction())
{
session.Save(new Student { Name = "Ayende", StudentNumber = 999 });
session.Save(new Student { Name = "Fabio", StudentNumber = 123 });
t.Commit();
}

using (ISession session = OpenSession())
{
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
.SetFirstResult(1)
.SetProjection(Property.ForName("Name"));

var result = session.CreateCriteria(typeof(Student))
.Add(Subqueries.PropertyEqAll("Name", dc))
.List();

Assert.AreEqual(1, result.Count);
}

using (ISession session = OpenSession())
using (ITransaction t = session.BeginTransaction())
{
session.CreateQuery("delete from Student").ExecuteUpdate();
t.Commit();
}
}

Fabio Maulo February 4, 2009 at 8:48 PM

A dialect may support Variable limits; this mean that, for pagination, the sql-query executed don't change instead what change is the parameters values for paging matters.
The class SubqueryExpression are not supporting dialects with this feature.
The test to pass is NHibernate.Test.Criteria.CriteriaQueryTest.AllowToSetLimitOnSubqueries

Tuna Toksoz February 4, 2009 at 9:45 AM

I didn't get what you mean, can you clarify, Fabio?

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created February 3, 2009 at 10:40 AM
Updated December 4, 2010 at 3:38 PM
Resolved September 1, 2010 at 10:37 AM
Who's Looking?