Yes the solution is multi-query / multi-criteria both are for multi-resultset in one roundtrip
2008/12/22 Symon Rottem <[email protected]> > Maybe multi-query - one for the result set, one for the count? Using the > criteria api it might be possible to do with one criteria too. > > Symon Rottem > http://blog.symbiotic-development.com > > > On Mon, Dec 22, 2008 at 11:47 PM, MAMMON <[email protected]> wrote: > >> >> I'm not emotionally attached to the search stored procedure or >> anything. It was just the only tool in my box that solves that >> problem. I'm completely open to changing the strategy. >> >> So if these are my requirements: >> 1. Pull the least amount of data required (a single page) >> 2. Know the number of TOTAL records that match the query (for display, >> and to calculate the number of pages of results) >> >> What would my other options be? I've only ever used SPs mapped with >> <sql-query> elements, and the criteria API. What would your >> preference be if you had only the above constraints? >> >> On Dec 22, 3:20 pm, "Fabio Maulo" <[email protected]> wrote: >> > I can't help here... I don't like SP so much to use it for a select.I >> can >> > understand the use of SP for a legacy DB (as you probably know I have >> > implemented some new feature in NH2.1 to support Identity even in SP and >> > even if I don't like Identity at allhttp:// >> fabiomaulo.blogspot.com/2008/12/identity-never-ending-story.html). >> > I can understand SP for some really special action involving bulk >> executions >> > or something that the DBA can write better than application developers. >> > >> > I can't answerer a question about how write a new SP for a select to use >> it >> > with NH... it is more strong than I. >> > I'm sorry. >> > >> > 2008/12/22 MAMMON <[email protected]> >> > >> > >> > >> > >> > >> > > I also need to figure out a good paging solution. I have a stored >> > > procedure that gives me my search results, and I could probably add >> > > @pageNum and @pageSize parameters to it easily enough, but how would >> > > you go about returning the TOTAL number of rows from the query? I >> > > know that in the SQL, I'd probably have to do 2 queries; one to return >> > > the actual records WITH paging restrictions, and one to return the >> > > count of ALL records that matched the query, WITHOUT paging >> > > restrictions. These could potentially be 2 different stored >> > > procedures, or maybe just 1 that returns 2 data sets. Can NH handle >> > > SPs that return multiple result sets? My SP is currently mapped with >> > > a <sql-query> attributes, and the results are loaded to an entity >> > > type, so I'm not sure how all that would work when it comes to getting >> > > the count of results. >> > >> > > On Dec 18, 5:45 am, "Fabio Maulo" <[email protected]> wrote: >> > > > Which should be be the solution to make a StoredProcedure a >> > > DynamicPaginable >> > > > SQL ?Perhaps what you are needing is only add two parameters to your >> SP >> > > and >> > > > set values, of parameters, as you are doing for the others >> parameters. >> > >> > > > 2008/12/17 Renso <[email protected]> >> > >> > > > > My situation requires me to construct a complex sql query for a >> > > > > generic search feature. I created a stored procedure for this. >> > > > > However, seems the dynamic paging support with NH ver 2.0 is still >> > > > > missing. Has anyone had similar issues and possible solutions? I >> did >> > > > > not want to go through the trouble of creating a temp table in the >> > > > > stored procedure to support paging unless there is an easier way, >> > > > > perhaps a newer version of NH supports it? >> > >> > > > -- >> > > > Fabio Maulo >> > >> > -- >> > Fabio Maulo >> >> > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
