Particular reason for not simply having your ID typed as decimal too? /Oskar
2012/9/14 Jason Kossowan <[email protected]> > I have an NHibernate implementation sitting on Oracle 11g where our > identifier columns in Oracle are defined as *NUMBER(10,0)* and our > entities have an ID of type *long*. I'm using sequence identity > generation for each table. > > When I insert a new entity to the database, NHibernate tries to set > Entity.Id (default: 0) to the generated sequence from the database, but is > constantly throwing > > *NHibernate.PropertyAccessException : The type System.Decimal can not be > assigned to a property of type System.Int64 setter of <entity>* > > Previous fixes have been to hack > OutputParamReturningDelegate.ExecuteAndExtract to do the following: > > *return Convert.ChangeType( > ((IDbDataParameter)insert.Parameters[driveGeneratedParamName]).Value, > Persister.IdentifierType.ReturnedClass);* > * > * > However, I'd prefer to intercept this somewhere in my own app that doesn't > involve changing the NHibernate library. > > Suggestions on where this can be accomplished? > > Thanks for your time, > Jason > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/nhusers/-/NcRy___K5k0J. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
