I isolated the problem as much as I could.
This is the mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<!-- WatchDogEntry -->
<!-- ***************************************** -->
<class name="SilverBytes.BSL.DomainModel.Core.WatchDogEntry, SilverBytes.BSL.DomainModel"
table="WatchDogEntry">
<id name="Id" column="Id" unsaved-value="null" >
<generator class="assigned" />
</id>
<property name="Login" />
<property name="IpAddress" />
<property name="MachineName" />
<property name="TimeStamp" />
</class>
</hibernate-mapping>
The WatchdogEntry class is straight forward (not inheriting from any class). The constructor sets the Id to a new guid value.
I think the App.config is quite normal as well:
Code:
<nhibernate>
<session-factory name="NHibernate.Test">
<add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
<add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="connection.connection_string" value="my connection string" />
<add key="use_outer_join" value="false" />
</session-factory>
</nhibernate>
The log output (Nhibernate DEBUG) can be found at http://www.silverbytes.at/test.logThe testcase to reproduce this looks like this:
Code:
[Test]
public void StoreWatchDogEntry()
{
Guid myGuid = Guid.NewGuid();
WatchDogEntry wdEntry = new WatchDogEntry("hello", "ip", "machine");
wdEntry.Id = myGuid;
Session.Save(wdEntry);
Session.Flush();
RefreshSession();
IList foundObjects = Session.Find("from WatchDogEntry as wde where wde.Id = ?", myGuid, NHibernateUtil.Guid);
wdEntry = (WatchDogEntry) foundObjects[0];
Assert.AreEqual(myGuid, wdEntry.Id);
}
The test output tells the following:
Quote:
TestCase 'SilverBytes.DomainModel.WatchDogFixture.StoreWatchDogEntry' failed:
expected:<5d5247eb-458e-4506-99fa-d6fe9f80a03c>
but was:<33895e8f-c1d9-4145-91fe-ead5d4e70f85>
c:\dev\vaa