Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

[NHibernate-development] Clearing Projections.ProjectionList

Christopher Knight

2008-03-04

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi,

 

I am currently upgrading our application to NHibernate 1.2 but have encountered a problem that I could do with some help with.

 

I need to create an ICriteria object and do a RowCount on this (for use with a pager). I then need to add a sort to this ICriteria and select just 12 rows (start position depending on the selected page).  The problem I seem to be having is that once I have added Projection.RowCount() to the ICriteria I am unable to remove this RowCount.  Does anyone know of a way to remove Projections?

 

I have supplied some example code to hopefully help to explain what I need.

 

ICriteria q             = m_Query;

SearchContainer s = new SearchContainer();

s.Count = (int)q.SetProjection(Projections.ProjectionList().Add(Projections.RowCount())).List()[0];

 

m_Pages           = (int)s.Count;

 

// I need to clear the ProjectionList at this point

q                 = GetSort(q, this.m_Sort, this.m_SortDir);

 

q.SetMaxResults(m_VehiclesPerPage);

q.SetFirstResult(m_CurrentStartPage);

m_Vehicles = q.List();

 

Any assistance would be gratefully appreciated.

 

 

Cheers

 

Chris Knight
Web Applications Developer




Codeweavers Limited
11 Imex Technology Park
Bellringer Road
Trentham Lakes South
Stoke on Trent
Staffordshire
ST4 8LJ

Tel: 0870 443 0888
Fax: 0870 443 0889

Registered in England and Wales No. 04092394. VAT registration no. 823826816

This email and its attachments are intended for the above named recipient(s) only and may contain confidential information.
Any liability (in negligence, contract, or otherwise) arising as a result of any third party taking any action on the basis of the information contained in this email is hereby excluded.
The views of the author of this email may not reflect those of Codeweavers Ltd or its associates. Codeweavers Ltd accepts no responsibility for the views, statements, or opinions of the author.
Emails to and from us are monitored for operational reasons and in accordance with lawful business practice.

 


Attachment: cid:image001.jpg@01C87E0B.1E8630F0

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.