Hello,
I have a legacy database and  I need to rapresents the absence of an
entity with 0 and not with NULL.
I'm using NHibernate 3 in my project.

With the help of Google I found this post:

http://nhforge.org/blogs/nhibernate/archive/2011/01/28/how-to-use-0-instead-of-null-for-foreign-keys.aspx

I have translated the code in VB.NET and you can find my version here
(the post is in Italian but I have inserted the code):

http://blogs.ugidotnet.org/alessandro_sorcinelli/archive/2011/02/22/nhibernate-utilizzare-lo-0-per-rappresentare-lrsquoassenza-di-entitagrave.aspx

When I try to use the NullableTuplizer I have a strange error. In my
project I have a main class Document with a Many-to-One relation with
the class User. In the database the absence of User is expressed with
the 0 in the column UserID of the table Documents.
So I would like to use the NullableTuplizer with the Document class.
When I try to save a Document class with a null user I have this error
message:

No row with the given identifier exists[Document#0]

I have debugged the NullableTuplizer and it seems that is doing the
right job. I don't know why NHibernate give that error. Anyone have
tried to use the NullableTuplizer?
Is there another way to handle this situation?

Thanks,
Alessandro

P.S. Unfortunatly I can't modify the legacy database

-- 
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