db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrik Vendelbo" <hvende...@bluprints.com>
Subject Re: simple reference problem
Date Wed, 04 Feb 2004 19:09:09 GMT
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" <andres@rizo.net>
To: "'Apache Torque Users List'" <torque-user@db.apache.org>
Sent: Wednesday, February 04, 2004 6:35 PM
Subject: RE: simple reference problem


try

handset.save()

-----Original Message-----
From: Henrik Vendelbo [mailto:hvendelbo@bluprints.com]
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: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message