|
Hi all,
I am having trouble creating a mapping for a one to 0..1 relationship in my database. I am working with a database that is already created and can not be changed. In my database I have an article object. Articles have abstracts associated with them in a different table that shares a primary key with my articles table. However not all articles have an abstract. Ideally the behavior I would like to see is that if I retrieve an Article from the database that has an abstract. The abstract field of my article domain object will be instantiated and contain the abstract from the database. However, if no abstract exist the Abstract field and property should return null. Is this possible with Nhibernate and if so how would I go about doing this? I found one suggestion online that I should use a many-to-one mapping with an unique attribute but I could not get this to work as I described above. Any help would be greatly appreciated.
Sincerely,
Adam Carasso
|