Re: [nhusers] Possible SQL Server bug

44 zobrazení
Přeskočit na první nepřečtenou zprávu
Zpráva byla smazána

Fabio Maulo

nepřečteno,
3. 3. 2009 15:34:3103.03.09
komu: nhu...@googlegroups.com
sure it fail.
You should use H-SQL if you want that NH do something with your SQL or you should use HQL or Criteria.

SELECT {u.*} FROM USER {u} ORDER BY id desc")

For H-SQL : http://nhforge.org/doc/nh/en/index.html#manipulatingdata-nativesql

2009/3/3 Robin Nadeau <ro...@alertpay.com>
In NHibernate 2.0 using SQL Server 2008, if I create a query such as:
Session.CreateSQLQuery("SELECT * FROM USER ORDER BY id desc").AddEntity(typeof(User).SetMaxResults(100).SetFirstResult(1).List<User>();

Then the sql statement fails.

--
Robin Nadeau, B.Eng.
Software Developer





--
Fabio Maulo

Fabio Maulo

nepřečteno,
3. 3. 2009 15:36:4303.03.09
komu: nhu...@googlegroups.com
I mean... If you want a pure SQL don't use SetMaxResults or SetFirstResult, write the full SQL by your self.

If you want NH doing something, write the SQL in a way NH can understand how work with it.

2009/3/3 Fabio Maulo <fabio...@gmail.com>



--
Fabio Maulo
Zpráva byla smazána

Tuna Toksoz

nepřečteno,
3. 3. 2009 15:53:1603.03.09
komu: nhu...@googlegroups.com
doh! what's phb anyway?


Tuna Toksöz
http://tunatoksoz.com
http://turkiyealt.net
http://twitter.com/tehlike

Typos included to enhance the readers attention!



On Tue, Mar 3, 2009 at 10:50 PM, Robin Nadeau <ro...@alertpay.com> wrote:
I want to use HQL or criteria API, but PHBs insist we stick with native SQL. How difficult would this be to fix in the provider for sql server? Thanks for your response.
Zpráva byla smazána

Bill Barry

nepřečteno,
3. 3. 2009 16:23:3703.03.09
komu: nhu...@googlegroups.com
Pointy Haired Boss

Robin Nadeau wrote:
I can't quite remember what PHB means, but it's from Dilbert.

Fabio Maulo

nepřečteno,
3. 3. 2009 16:44:5403.03.09
komu: nhu...@googlegroups.com
Try to fix it hahahaha.
If your boss want use SQL he should say something to you because you are using "SELECT *" instead a SELECT with all field explicitly.
NH give you the facility to do the work for you writing {alias.*}...

As last... your boss want you write SQL ? well do it, and don't use NH for pagination matters.

2009/3/3 Robin Nadeau <ro...@alertpay.com>
I want to use HQL or criteria API, but PHBs insist we stick with native SQL. How difficult would this be to fix in the provider for sql server? Thanks for your response.

On Tue, Mar 3, 2009 at 3:36 PM, Fabio Maulo <fabio...@gmail.com> wrote:



--
Fabio Maulo
Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv