When reading Hibernate in Action,
On page 110, it says:
"Without the inverse attribute, Hibernate would try to execute two different SQL statements, both updating the same foreign key column..."
Does that mean that this will happen when you end up calling both? i.e.:
session.save(item);
session.save(bid);
So, when calling session.save(item), Hibernate would grab the foreign key out of 'bid' and store it in the ITEM table. Then, when calling session.save(bid), Hibernate would persist 'bid' to BID table, grab its primary key (possibly just out of 'bid' instance) and then update ITEM table with it (as a foreign key)?
And same would be true if cascade="save-update" is specified and inverse="false", expect the second call, session.save(bid), would be implicit (Hibernate takes care of this).
Is this understanding correct?
Thanks,
NG.
|