Hi Nhibernate Users!
I have a small issue with using the time stamp column in SQL server 2005 when I run the schemaexport code, its creates the timestamp as a DateTime field, which if course causes my inserts to fail.
Anyone know how I can get nhibernate to create the table using "Timestamp" rather than "DateTime" for the columns defined as "Timestamp"?
If not how are other people implement concurrency management on SQL Server 2005?
This is the code that creates the DB fromt he schema files:
Code:
// Rebuild the database tables according to the schema files.
SchemaExport SchemaExport = new SchemaExport(_unitOfWorkFactory.Configuration);
// Execute the schema update.
SchemaExport.Execute(script, export, justDrop, format);
NHibernate version::2.0.50727
Mapping documents::
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="TEST.DataAccess.Tests" namespace="TEST.DataAccess.Tests">
<class name="TestPerson" optimistic-lock="version">
<id name="Id">
<generator class="guid"/>
</id>
<version column="Version" type="Timestamp" name="Version" unsaved-value="null" generated="always" />
<property name="Name" not-null="true" length="50"/>
<property name="Birthdate" not-null="true"/>
</class>
</hibernate-mapping>
Name and version of the database you are using:Microsoft - SQL Server 2005
The generated SQL (show_sql=true):NHibernate: INSERT INTO [Test].[dbo].TestPerson (Name, Birthdate, Id) VALUES (@p0, @p1, @p2); @p0 = 'John Doe', @p1 = '15/12/1915 12:00:00 AM', @p2 = '10c27ab9-75d5-4351-ab4d-4cd04a439b7c'
[/code]