Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to update entity bean with relationship and foreign key contraint

0 views
Skip to first unread message

Kar

unread,
Mar 4, 2002, 10:15:05 PM3/4/02
to
I have entity Person with cmr field address of Address entity bean the
addressId is nullable. What is the correct way of update the address
entity and the person entity in one transaction (ie one method call)?
I got a foreign key constraint error when I do this

person.setxxxx
Address addr = person.getAddress();
if (addr != null) {
addr.setXXX...
} else {
addr = addrHome.create(.....);
person.setAddress(addr);
}

It appears the insert statement was not executed before the update
statement. Is it correct? If it is then what is the work-around?

TIA.

Regards,
Kar

0 new messages