The default hilo generator is implemented to work with a NH's PrimitiveType.Remove this limitation, in NH, is *not* a big work even if I don't think it can solve your problem because the minimal required interface should be IType... so, in your case, we are returning in the same place.
I have a lot of question to ask you but... well... I'll try to summarize it in two question and a link: which is the reason to store a zero and then transform it in a null when the DataBase allow null everywhere ? way such DB does not have a problem with the FK (when the value is zero instead null) ? now the link: http://fabiomaulo.blogspot.com/2009/06/database-eliot-ness-of-it.html 2009/6/25 David Henry <[email protected]> > > Sorry, I'll try to clarify. > > My mapping is defined similar to: > > <id name="ID" type="Foo.UserTypes.IntZeroAsNullIdentifier, foo"> > <generator class="hilo"/> > </id> > > When running a test, there is an error similar to "type is not a > ValueTypeType". This seems to be because IntZeroAsNullIdentifier does > not inherit from PrimitiveType. > IntZeroAsNullIdentifier is a UserType that will recognize database > values of 0 as null. This is used for null many-to-many associations > > I was looking for any guidance with using HiLo with a custom type. > Currently, I'm thinking of directly inheriting from PrimitiveType and > use similar code for Int32Type, but recognizing 0 as null. > > Thanks, > -David > > On Thu, Jun 25, 2009 at 4:34 PM, Fabio Maulo<[email protected]> wrote: > > I don't understand. > > > > 2009/6/25 David Henry <[email protected]> > >> > >> Hello, > >> > >> I am looking into replacing our id columns that are currently MSSQL > >> identity to HiLo generated values to support UoW. > >> > >> To support some legacy data associations, we have the concept that 0 > >> means null for the association mappings - so we have a UserType that > >> uses 0 as a null identifier for integer. > >> > >> As far as I have gathered, the TableHiLoGenerator seems to use > >> identifier types that are derived from PrimitiveType. Does anyone have > >> any suggestions on how to resolve this, or can clarify the identifier > >> types that are to be used with HiLo? > >> > >> Thanks, > >> > >> David > >> > >> > > > > > > > > -- > > Fabio Maulo > > > > > > > > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
