SQLite Versioning Configuration Question

101 views
Skip to first unread message

Mark B.

unread,
Sep 7, 2010, 1:44:08 PM9/7/10
to Fluent NHibernate
Hello All,

I am trying to use SQLite (version 3 in-memory db) within my
integration tests, but my tests consistenly fail throwing the
following message:

System.Data.SQLite.SQLiteException : Abort due to constraint
violation
Version may not be NULL

I have mapped a very simple object using optimistic concurrency as
follows:

Id(x => x.Id).GeneratedBy.GuidComb();
...
OptimisticLock.Version();
Version(x => x.Version)
.Column("Version")
.UnsavedValue("null")
.CustomSqlType("timestamp")
.Generated.Always();

When I run my tests against MS SQL Server, the insert statement that
is generated does not pass a value for the 'Version' field. SQLServer
creates a binary value and inserts that value into the 'Version' field
automatically.

When I try to run my tests against my SQLite in-memory db, however,
the binary value is not auto-generated by SQLite. (which leads to the
aforementioned exception)

Is there any way to map an object so that the Version field auto
generates a binary value for both MS SQL Server and SQLite? Any help
is MUCH appreciated!

James Gregory

unread,
Sep 7, 2010, 3:47:52 PM9/7/10
to fluent-n...@googlegroups.com
If it's SQL Sever that's doing the generation, and SQLite isn't, then there's nothing you can really do about it. Not all databases act the same, sadly.


--
You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
To post to this group, send email to fluent-n...@googlegroups.com.
To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.


Reply all
Reply to author
Forward
0 new messages