Hello!

I can't figure out how to properly map using fluent api the following one to one relationship:

Database:

Table1
---------------
ID
DESCRIPTION
CODE NULLABLE

Table2
--------------
TABLE2_ID
DESCRIPTION

The pseudocode:

public class Table1
public property Id as integer
public property Description as string
public overridable property Code as Table2

end class

public class Table2
public property Id as integer
public property Description as string
end class

How do I do the mapping for this using fluent api? There is a 1-0 relationship since CODE column can be null. I don't need to navigate from Table2 to Table1, but when I save table1 the Table2 object in Table1 should be saved also.

I have spent an entire day with this but I keep getting errors that the foreign key is not declared when trying to save Googling haven't found an example with a nullable unidirectional mapping like the one I have.

Help please

/H