Hello group,
I'm standing in front of a wall and banging my head. I have a timestamp column in a table in a SQL2005 database (not sure whether there's a difference to SQL2000). I should also mention that I'm using NHibernate.Mapping.Attributes rather than plain mapping files.
Now I'd like to use either the <version> or <timestamp> mapping to expose that value as a property, ideally using DateTime so I can check the last modification date e.g. for geting all objects that changed during the past 24 hours.
Here's the most recent thing I tried:
---------------------------------
Code:
Guid m_ID = Guid.Empty;
int m_LastModification = 0;
[Id(0, Name = "ID", Column = "ID", TypeType = typeof(Guid), UnsavedValue = "00000000-0000-0000-0000-000000000000")]
[Generator(1, Class = "guid.comb")]
[Version(2, Column = "LastModification", AccessType = typeof(PascalCaseMUnderScore))]
public Guid ID
{
get { return m_ID; }
set { m_ID = value; }
}
public int LastModification
{
get { return m_LastModification; }
}
When I try to load a list I get the following exception:
Code:
"NHibernate.ADOException: Could not cast the value in field LastModi2_0_ of type Byte[] to the Type Int32Type..."
I already tried different data types such as byte[] or Int32 for the LastModification property. Does anybody have a working example of how to use NHibernate.Mapping.Attributes with a timestamp column?
Thanks, Christoph