Thank you for your reply. Nhibernate 2.1 looks promising. However, if hql is supposed the same as in Hibernate, then the syntax for update statement has its serious constrains. As http://docs.jboss.org/hibernate/core/3.3/reference/en/html/batch.html#batch-direct says the form should be
( UPDATE | DELETE ) FROM? EntityName (WHERE where_conditions) What if I'd like to update only first 10 rows? In sql I use 'select top 10...' , but that doesn't work here. On Jan 14, 1:04 pm, Markus Zywitza <[email protected]> wrote: > As of 2.1 it can update and delete with HQL: > > http://nhforge.org/blogs/nhibernate/archive/2009/05/05/nh2-1-executab...http://ayende.com/Blog/archive/2009/05/28/nhibernate-ndash-executable...http://nhforge.org/blogs/nhibernate/archive/2009/05/13/nhibernate-2-1... > > -Markus > > 2010/1/14 stej <[email protected]>: > > > Hey guys, I'm in doubts wheter Nhibernate is the right choice in my > > project. > > > I use a framework created by my company which uses NHibernate for data > > accesing and manipulation. That's why I started with NH as well. > > > Why I'm not sure: > > Currently half of the queries is done in a standard way. But the other > > half uses sql (ISQLQuery) via CreateSQLQuery. > > > ----------- > > Where standard: > > - With every request I add one object to a table ABC. > > - Sometimes I need to load an record with given ID. > > > ----------- > > Where sql: > > - I need to download the data in batches. With every request I should > > send (e.g.) 1000records from table ABC. > > There can be more threads in downloading involved. That's why I first > > mark the rows with a unique id > > session.CreateSQLQuery("update v set v.batchId = :batchId from ABC v") > > and download them > > session.CreateQuery("select v from ABC v where v.batchId = :batchId"); > > This ensures (I hope) that each thread gets its own set of records. > > > Note that I can not do it via NHibernate - it doesn't have any Update > > method for collections, nor there are any HQL for that. > > > When I'm deleting rows, I don't want to load them all from database to > > delete them - it is unnecessary overhead. Futhermore I need to delete > > them at once using some condition, not to send 1000 delete requests. > > > ------------ > > Am I wrong somewhere, or use I Nhibernate on the wrong place? > > > -- > > 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 > > athttp://groups.google.com/group/nhusers?hl=en.
-- 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.
