Update TOP of rows with FNH

Arkady's Avatar

Arkady

01 Jul, 2010 10:47 AM via web

Is there any way i can run update of specified number of TOP rows:

UPDATE TOP (1) MyTable...

Once i put it into
session.CreateQuery("UPDATE TOP (1) MyTable ...") i get exception

or if i put it into
session.CreateQuery("UPDATE TOP (1) MyTable ...")

                        .SetFirstResult(0)
                        .SetMaxResults(1)

It does not pay any effect... still all rows in table being updated...

Thanks for help!

  1. 2 Posted by Arkady on 02 Jul, 2010 08:02 AM

    Arkady's Avatar

    Any update on this from support team?

    Please give me some tips reagards - how would i do it? Or point to documentation...

    Thanks!

  2. Support Staff 3 Posted by James Gregory on 02 Jul, 2010 08:13 AM

    James Gregory's Avatar

    Why would you want to do that? NHibernate is for working with entities, not raw SQL. If you want to modify rows in a table, use ADO.

  3. 4 Posted by Arkady on 02 Jul, 2010 08:18 AM

    Arkady's Avatar

    Well, main point here - i need to do it in transaction with isolation - other processes with same functionality should not be able to load same row set and update them second time.
    May i use entities model with isolation? How?

    ADO is fine, but i loose multi - db access feature, which is unacceptable...

    Thanks for reply!

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    Ten divided by two is what?