I have personally used SQLite with HiLo, Guid.Comb, and Assigned and I can
tell you those work just fine. Never tried using an identity generator with
it.

Sorry that article didn't help.

- Robert

On Mon, Mar 22, 2010 at 11:58 AM, Dinesh <[email protected]> wrote:

> Robert,
>         That article also stresses on Concurrent writes failing for
> not having exclusive lock. In my case it probably is a single write
> which hasn't even started (it is just the transaction that started,
> followed by a separate read. so i was hoping that the read would
> succeed. I see very less options for identity generation, HiLo would
> fail for the same reason, and SQLite does not support sequences.
>
> Since lots of NHibernate users seem to be using InMemory SQLite Db i
> thought this might be something that many people would have had an
> issue and found a solution.
>
> Regards
> Dinesh
>
> On Mar 22, 8:11 pm, Robert Rudduck <[email protected]> wrote:
> > Any write operation locks the entire database. You are going to have to
> do
> > your identities a little different if you want to work with SQLite.
> >
> > http://weblogs.asp.net/jgalloway/archive/2005/07/08/418472.aspx
> >
> > - Robert
> >
> >
> >
> > On Mon, Mar 22, 2010 at 9:15 AM, Dinesh <[email protected]> wrote:
> > > Hi everyone,
> > >      When trying to use SQLite with System.Transactions
> > > TransactionScope with the identity generator as Increment, i noticed
> > > that i was getting an exception (given below along with code) when
> > > NHibernate was trying to retrieve the next Identity number. This seems
> > > to be because the new SQLite connection is doing a auto enlist of the
> > > current transaction. From what i have heard SQLite only support single
> > > write transaction, but should support multiple read's, so i am
> > > surprised that i am getting a Database locked exception for a read
> > > operation. Did anybody use SQLite with Transaction Scope in this
> > > manner. The same Code works fine if i use a NHibernate Transaction
> > > instead of TransactionScope
> >
> > > Code Block:
> > >           using (var scope = new TransactionScope())
> > >            {
> > >                var userRepository =
> > > container.GetInstance<IUserRepository>();
> > >                var user = new User();
> >
> > >                userRepository.SaveOrUpdate(user);
> >
> > >                scope.Complete();
> > >            }
> >
> > > Exception:
> > > 19:34:19,126 ERROR [   7] IncrementGenerator [(null)]- could not get
> > > increment value
> > > System.Data.SQLite.SQLiteException: The database file is locked
> > > database is locked
> > >   at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
> > >   at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
> > >   at System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection
> > > connection, Boolean deferredLock)
> > >   at System.Data.SQLite.SQLiteConnection.BeginTransaction(Boolean
> > > deferredLock)
> > >   at System.Data.SQLite.SQLiteConnection.BeginTransaction()
> > >   at System.Data.SQLite.SQLiteEnlistment..ctor(SQLiteConnection cnn,
> > > Transaction scope)
> > >   at
> > > System.Data.SQLite.SQLiteConnection.EnlistTransaction(Transaction
> > > transaction)
> > >   at System.Data.SQLite.SQLiteConnection.Open()
> > >   at NHibernate.Connection.DriverConnectionProvider.GetConnection()
> > >   at NHibernate.Id.IncrementGenerator.GetNext(ISessionImplementor
> > > session)
> > > 19:34:20,063 ERROR [   7] ADOExceptionReporter [(null)]- The database
> > > file is locked
> > > database is locked
> >
> > > Regards
> > > Dinesh
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "nhusers" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to