I have a parent child relationship
A (1..1) --> (0..1)B
Class A
{
private B b;
}
I dont want a B_ID reference in the 'A' DB table. just the A_ID FK in the 'B' table.
In the mapping of B, I have:
<many-to-one name="A' column="A_ID" class="A" not-null="true"/>
that takes care of the ownership of B (and the FK from the B back to A)
Is it possible to somehow have class A mapped, and only call the setB( B b ) method if there is an entry in table B with the ID of A, otherwise the object reference in A will remain null?
Ive seen the examples in Hibernate in Action as well as in the ref guide, but they all have a Set<B> mapped in class A
Nick
|