Henrik Vendelbo wrote:

On two related tables I try to insert new records. On handset there is a
foreign key enforcing 'consumerid' to refer to a consumer.
I have tried using handset.setConsumerid() and handset.setConsumer(). In
either case it fails on the foreign key constraint.

What might be the problem ?
consumer = new Consumer();

consumer.setFirstName("John");

consumer.setSurname("Doe");

consumer.setHouseNo("25");

consumer.setBirthdate(new Date("01/01/1970"));

consumer.setLanguage((byte)1);

consumer.setCreated(new Date());

consumer.save();


handset.setConsumer(consumer) ;


handset.setPhoneNo("0044416886");

handset.setPhoneManufacturer(1);

handset.setPhoneModel(1);

ConsumerHandsetPeer.doInsert(handset);


It might be helpful to post your schema.

Scott

--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to