From: NHibernate J. <mik...@us...> - 2006-11-14 09:49:26
|
[ http://jira.nhibernate.org/browse/NH-788?page=comments#action_14391 ] Jens Dein commented on NH-788: ------------------------------ Sorry about that! I was actually just trying to generate a test case but not w I can't make it fail. I'm a bit new at this so I'm not quite sure what it is I have done - but it seems that the problem is gone. > Incrementing a nullable <Version> field fails > --------------------------------------------- > > Key: NH-788 > URL: http://jira.nhibernate.org/browse/NH-788 > Project: NHibernate > Type: Bug > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Jens Dein > Priority: Minor > Attachments: Serialno.hbm.xml > > I have defined my version tag like this : > <version > name="Hbversion" > column="HBVersion" > type="System.Int32" > unsaved-value="null" > /> > and in my class like this : > private System.Int32? _hbversion; > and when trying to persist the code I get an error in the following code : > public class Int32Type : ValueTypeType, IDiscriminatorType, IVersionType > public virtual object Next( object current ) > { > return ( ( int )current ) + 1; > } > besause current is typecasted to int without checking for null. Code might be changed to the following : > public virtual object Next( object current ) > { > if (current == null) > return Seed; > else > return ((int)current) + 1; > } > I hope I havent misunderstood totally how to use these nullables, but I believe I found advise on the net stating that it should be possible to do it this way in the 1.2 version. > Using .NET 2.0 of course and SQL Server 2005. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |