db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Emminger <e...@ericemminger.com>
Subject Re: Inserting NULL for foreign refereces
Date Mon, 18 Aug 2003 18:54:07 GMT

>     I have a silly question and I was not able to find a similar case on
> list archive.
> I have a table A with the following columns:
> A_ID                      INTEGER PRIMARY NOT NULL
> A_NAME              VARCHAR(X) NOT NULL
> B_ID                      INTEGER NULL (Is a foreign reference for B_ID from
> table B)
> I also have a table B:
> B_ID                      INTEGER PRIMARY NOT NULL
> B_NAME              VARCHAR(X) NOT NULL
> When I try to insert values on table A as following, I get a referential
> integrity violation:
> A a = new A()
> a.setAName("XXXX");
> a.save();
> I think Torque is trying to insert 0 on B_ID (default values from new
> integer types are 0) but
> I really want to set it NULL.
> Any clues?

In your schema xml, are you using javaType="object" for the primary- and 
foreign-key columns?


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

View raw message