The doc says:
".. there are two varieties of one-to-one associations:
1. primary key association
2. unique foreign key association ..."
So, if your association is the first one (and this is what your mapping looks like), you don't need a foreign key (extra table column) at all, as the two rows share the same primary key value.
If it's the second one, i.e. if your class Two has a property that references One, then your mapping should look like:
<class name="hibernate.One" table="one">
<id name="id" type="java.lang.Integer" column="id">
<generator class="identity" />
</id>
<!-- Associations -->
<many-to-one name="two" class="hibernate.Two" column="two_id" unique="true" cascade="all"/>
</class>
<class name="hibernate.Two" table="two">
<id name="id" type="java.lang.Integer" column="id">
<generator class="identity"/>
</id>
<one-to-one name="whatever your property's name is" class="hibernate.One" property-ref="two"/>
<property name="value" type="java.lang.String" column="value" length="255" />
<!-- Associations -->
</class>
This should work.
Alice
|