db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Menard <j...@io.com>
Subject IDs not generated until after save?
Date Thu, 18 Dec 2003 16:47:05 GMT
I'm trying to confirm my understanding of primary/foreign key 
associations in newly-created objects. With the code

	BillAccount account = new BillAccount();
	Address address = new Address();


I see the exception
	ExecInsert: Fail to add null value in not null attribute 

Is it true that the address's primary key is not set until after the 
save? (I've used another Object/Relational package where the id is set 
in memory before the save.)

If the primary key is not set until after the save, then it looks like 
I can't associate the address with the account until after the address 
has been saved. I have to write my code like this instead:

	Address address = new Address();

	BillAccount account = new BillAccount();

Thank you for your help.

Jim Menard, jimm@io.com, http://www.io.com/~jimm/
"Any sufficiently advanced technology is indistinguishable from a
rigged demo." -- Unknown

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

View raw message