Dennis,

I've never personally had an issue with guids in SQLite, but I've heard that
SQLite is a little wonky when it comes to guids - unrelated to NHibernate.
This may have your answer:

http://sqlite.phxsoftware.com/forums/t/506.aspx

Thanks,
Jason

On Sun, Nov 8, 2009 at 7:16 AM, Pleb <[email protected]> wrote:

>
> Works on my machine Dennis and I'm using the same versions you
> mentioned above.
>
> You might need to post your mapping files. I suggest you make sure
> your ID column in marked as a primary, else I think the get method
> won't work.
>
> I set my test up using automap and this convention.
>
>    public class PrimaryKey : IIdConvention
>    {
>        public void Apply(IIdentityInstance instance)
>        {
>            instance.Column(instance.EntityType.Name + "ID");
>            instance.GeneratedBy.GuidComb();
>            instance.UnsavedValue(Guid.Empty.ToString());
>        }
>
>    }
>
>                [Test]
>                public void Test1()
>                {
>                        StubModel model;
>
>                        using (INHUnitOfWork unitOfWork =
> NHUnitOfWork.Begin())
>                        {
>                                model = new StubModel();
>
>                                unitOfWork.Session.Save(model);
>
>                                unitOfWork.Complete();
>                        }
>
>                        Assert.That(model.ID, Is.Not.EqualTo(Guid.Empty));
>
>                        using (INHUnitOfWork unitOfWork =
> NHUnitOfWork.Begin())
>                        {
>                                StubModel same =
> unitOfWork.Session.Get<StubModel>(model.ID);
>
>                                Assert.That(same, Is.Not.Null);
>                                Assert.That(same, Is.EqualTo(model));
>
>                                unitOfWork.Complete();
>                         }
>                }
>
> On Nov 6, 1:58 am, Dennis <[email protected]> wrote:
> > Im using NH version 2.1.0.4000. I am using a SQLite (1.0.65.0)
> > Inmemory db for integration testing.
> >
> > When I do a session.Get<MyEntity>(myGuid) it returns null even though
> > the record exists. With the ShowSQL set, I see the following:
> >
> > SELECT ... FROM "PolicyInfo" policyinfo0_ WHERE
> > policyinfo0_....@p0;@p0 = 778e2166-fb54-3082-e043-0a0a013a3082
> >
> > NOTE: If the @p0 = 778e2166-fb54-3082-e043-0a0a013a3082 is wrapped
> > with single quotes it will work.
> >
> > I have tried applying the "BinaryGuid=False" to the connection string
> > with NO success.
> >
> > Help?
> >
> > Thanks
> > Dennis
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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