NHibernate 2nd lvl cache, custom query, sqldialect

前端 未结 7 1088
遥遥无期
遥遥无期 2020-12-21 06:59

I got trunk version of NH and FNH. When i try to add 2nd level cache, some parts of NHibernate forgets about chosen sqldialect.


Initial configuration:

7条回答
  •  情书的邮戳
    2020-12-21 07:28

    I encountered this problem when upgrading from 1.2 to 3.2 (I know, BIG jump eh?).

    The issue in my case was that there is a leading space in front of the select statement in the hql, e.g. String hql = " select "...

    With SQL2005 Dialect, this crashes with a "System.NotSupportedException: The query should start with 'SELECT'..." message.

    The solution is to

    1. create a unit test that fails, a good Test Driven Developer should :)
    2. remove the leading space from the " select..." statement
    3. build and run the unit test

提交回复
热议问题