one option is to create a custom type and use that in your mapping for
the specific column.

not sure if you can assume zero is always null. if you can, have the
custom type convert all zero value to null. since I've always had to
integrate with legacy databases with ugly data, I feel your pain.

peter

On Jan 10, 1:54 pm, Marco <[email protected]> wrote:
> I can't clean the Db, it's a legacy application that used by many
> users all over the world.
>
> Can i conclude that's NHibernate doesn't support this (what is very
> logically, i totally agree that storing 0 instead of null is
> completely wrong..)
>
> Thanks
> Marco
>
> On 10 jan, 17:08, "Fabio Maulo" <[email protected]> wrote:
>
> > Ok but write a value (0 zero) in that field was not so smart... for that
> > reason RDBMS have the concept of null and for the same reason we have
> > nullables values in .NET.Don't add FK but clean the DB.
>
> > 2009/1/10 Marco <[email protected]>
>
> > > I already added not-found="ignore" and that works, but NHiberbate
> > > still tries to fetch the record because CountryID = 0 and not
> > > CountryID = null.. I'm looking for a way to disable the lookup for ID
> > > = 0..
>
> > > ps. adding FK's are no option, because of the legacy application.
>
> > > Thanks
> > > Marco
>
> > > On 10 jan, 14:08, "Fabio Maulo" <[email protected]> wrote:
> > > > not-found="ignore"
> > > > That is what you are looking for but would be better to remove all
> > > invalid
> > > > values from DB and add a formal FK.
>
> > > > 2009/1/10 Marco <[email protected]>
>
> > > > > There's no foreign-key in the database, only in the documentation.
> > > > > (the foreign key is handled at application level and there's no
> > > > > external API available.)
>
> > > > > Thanks
> > > > > Marco
>
> > > > > On 10 jan, 13:21, "Fabio Maulo" <[email protected]> wrote:
> > > > > > 2009/1/10 Marco <[email protected]>
>
> > > > > > >  How can i instruct nhibernate to handle the number 0 as null for
> > > > > > > relations?
>
> > > > > > How you can have that situation without a FK violation ?Which RDBMS
> > > are
> > > > > you
> > > > > > using ?
> > > > > > --
> > > > > > Fabio Maulo
>
> > > > --
> > > > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to