Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate's Increment Generator - could not fetch initial value

I'm trying to use NHibernate (and FluentNHibernate) over a legacy database. I'm also using SQLite for tests.

When I try to create a test for the mappings using FluentNHibernate's PersistenceSpecification, I get the following exception:

NHibernate.Exceptions.GenericADOException : could not fetch initial value for increment generator

I'm mapping my ID like this:

Id(f => f.ID, "OID").GeneratedBy.Increment();

My test uses SQLite, so when I ran them, the tables are initially empty.

Does someone have an idea how to solve this?

Thanks.

like image 742
caiokf Avatar asked Jun 16 '09 13:06

caiokf


1 Answers

You can also try:

Id(f => f.ID, "OID").GeneratedBy.Native()

This works for me in SQLite & SQL Server.

like image 98
JD Courtoy Avatar answered Oct 11 '22 22:10

JD Courtoy