Unit testing NHibernate Postgresql with SQLite. Sequence generator problem

Can Sqlite NHibernate id generator be made compatible with Postgresql? I'm planning to unit test my NHibernate Postgresql project based on this http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx

If there is no compatible id generator, is there a way to signal NHibernate to ignore id generator when it is using different dialect?

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" assembly="RuntimeNhibernate" namespace="RuntimeNhibernate" >

  <class name="Blog" table="blog">
    <id name="BlogId" column="blog_id">
        <!-- can this be ignored when using different dialect.. -->
        <generator class="sequence"> 
            <param name="sequence">blog_id_seq</param>
        </generator> 
        <!-- ...can this -->
    </id>


    <property name="AllowsComments" column="allows_comments"/>
    <property name="CreatedAt" column="created_at"/>
    <property name="Subtitle" column="subtitle"/>
    <property name="Title" column="title"/>


  </class>

</hibernate-mapping>  

Error when using Sqlite dialect on Postgresql-specific mapping:

NHibernate.MappingException: could not instantiate id generator: sequence ---> 
NHibernate.MappingException: Dialect does not support sequences

Answers


My suggestion is that you use a DB-agnostic generator, like HiLo.


Need Your Help

Create computed column with string in formula

asp.net sql sql-server sql-server-2005 tsql

I want to create a computed column in SQL SERVER and set the formula to this

Create labels in form and update them from background threads

c# multithreading winforms

I have a number of background threads (in this case 5) that generated like the code below:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.