db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Shea <s...@gtsdesign.com>
Subject Re: torque and nullable foreign keys
Date Tue, 09 Dec 2003 20:39:07 GMT
I have this problem also.  My only experience is with mysql so far, but
it appears that the schema generated by the ant 'jdbc' target always has
default values and never sets the 'javaType' attribute to "object".
As a result you have to make those changes manually or with an XSLT
script.  I attached the XSLT script I use to a recent post to the list;
if you can't find it in an archive somewhere let me know and I'll email
it to you off the list.

        Gary

[2003-12-09 19:27 +0100] Tillich, Adrian (Adrian.Tillich@tui.de) wrote:
> Hi,
> 
> I have this problem:
> an insert on a simple database table 
> like this:
> 	CREATE TABLE CITY_MAP
> 	(
> 		CITY_NAME	varchar(20)	NOT NULL,
> 		CITY_ID	int 		NULL,
> 		
> 		CONSTRAINT PK_MAP
> 	            	PRIMARY KEY NONCLUSTERED (CITY_NAME)
> 	)
> 	go
> 
> 	ALTER TABLE CITY_MAP
> 	     ADD FOREIGN KEY (CITY_ID)
> 	            REFERENCES CITY_ID
> 	go
> 
> fails, because Torque sets the foreign key field CITY_ID to a numeric 0
> instead of NULL.
> This is probably because the corresponding Torque-Peerclass uses the flat
> datatypes instead of the Objects for numeric datatypes.
> 
> Can I somehow configure this behaviour or is there a workaround?
> 
> Changing the database model is not really an option because I use an
> existing one.
> 
> Thanks,
> Adrian
> 
> 
> ---------------------------------------------------------------------
> 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