Hibernate version: 2.1
Name and version of the database you are using: mysql 4.1.7
I am trying to map a one to one relationship from A to B, where B has a foreign key a_id, which is the primary key of A.
I am using many-to-one relationship (as discussed in Chapter 5 of the documentation: Basic O/R Mapping):
<many-to-one
name="B"
class="com.me.B"
cascade="none"
outer-join="auto"
update="false"
insert="false"
access="property"
column="a_id"
unique="true"
/>
My question is, can the foreign key (a_id) in table B be null? In my application it can be null (needs to be null), but I get a hibernate lazy initialization exception when I try this.
I can't use a straight one-to-one because A and B are both joined-sublcasses of a similar parent.
Thanks,
Jay
|