Tell us why it failed. Post some stacktrace or log or something
-----Original Message-----
From: Henrik Vendelbo [mailto:[EMAIL PROTECTED]
Sent: Mi�rcoles, 04 de Febrero de 2004 04:09 p.m.
To: Apache Torque Users List
Subject: Re: simple reference problem
that fails, yet setting the consumerid to the value of 1 and then
inserting works just fine.
I thought that the primary key was automatically updated on a
save/insert, is that not so ?
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.setConsumerid(1);
handset.setPhoneNo("00447930416886");
handset.setPhoneManufacturer(1);
handset.setPhoneModel(1);
handset.save();
(code above failed)
----- Original Message -----
From: "Andres Quijano - Rizonet" <[EMAIL PROTECTED]>
To: "'Apache Torque Users List'" <[EMAIL PROTECTED]>
Sent: Wednesday, February 04, 2004 6:35 PM
Subject: RE: simple reference problem
try
handset.save()
-----Original Message-----
From: Henrik Vendelbo [mailto:[EMAIL PROTECTED]
Sent: Mi�rcoles, 04 de Febrero de 2004 03:34 p.m.
To: Apache Torque Users List
Subject: simple reference problem
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);
Cheers,
Henrik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]