Is there a trick to correctly defining version properties in NHibernate?

In the mapping - instead write type="Int32". If your property in your POCO is nullable it should work out fine.(At least it does for properties - I haven't tried having a nullable version column...).

Thanks; very helpful. That got me past the original exception. Now I'm hitting a different one.(question updated) – Mike Oct 4 '10 at 17:10 I think I misread your question... are you using decimal as the type in the version-column?

Type decimal is not supported as a version column (hence the - cannot cast to IVersionType-exception). – Goblin Oct 4 '10 at 17:13 Yes and no... yes, in that I am mapping a legacy database whose version properties are defined as "decimal(9,0)".(I can't change the schema. ) No, in that I am trying to map them all as 32-bit integers.

Not sure why this wouldn't work, except that if I get version numbers above 999,999,999 the database may complain. – Mike Oct 4 '10 at 17:21 The problem is that Nbernate when reading from the Database gets a decimal (as it should) and a decimal cannot be a version-column. Nbernate only supports whole numbers in the database column as well as the property in your POCO.

– Goblin Oct 4 '10 at 17:37 Sadly, I believe you need to handle versioning manually by putting it into a normal decimal property and then handling the concurrency in an interceptor. – Goblin Oct 4 '10 at 17:38.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions