db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Beier" <mbe...@VPS.DE>
Subject AW: Creating records with value NULL for FKs
Date Mon, 03 May 2004 08:35:13 GMT
You say, that your PK is of Type INTEGER.
Maybe you could use NUMERIC, so INTEGER (-x -> 0 ->+x) NUMERIC (-x -> 0 ->+x and
null) what would be needed, if there should not be a FK-Reference. 


-----Urspr√ľngliche Nachricht-----
Von: Saravana Kannan [mailto:skkann0@engr.uky.edu]
Gesendet: Montag, 3. Mai 2004 02:21
An: Apache Torque Users List; mailreg@numerixtechnology.de
Betreff: Creating records with value NULL for FKs


Hi,

Related in the sense, the assumption in your question is the reason for my 
question. Looks like you got ticked off by my mail for some reason - if so, 
sorry about that.

Can someone help me?

I will post me question again just in case -

I have a Torque Object called Answer which is related to AnswerGroup and 
ExprNode. Answer can be either the child of AnswerGroup OR a child of ExprNode 
(ie Answer has two FKs - one referencing AnswerGroup and the other referencing 
ExprNode).

So I do something like-

AnswerGroup ansgrp = new AnswerGroup();
AnswerGroup ans = new Answer();
..
(calling setter methods)
..
ansgrp.save();
ansgrp.addAnswer(ans);
ans.save();

And I get the Torque Exception which is the result of an Oracle constraint 
error. The Oracle error was something of the sort-
"Foreign key 0 does not exist in ExprNode"

The question here is - Why is Torque/Village setting ANSWER.ExprNodeFK to "0" 
when I never called ExprNode.addAnswer(ans) or ans.setExprNodeFK() ? I want the 
ANSWER.ExprNodeFK to be null. I'm unable to create foreign keys which are null. 
How does one create a FK which is null? As is the norm, my foreign keys are of 
type INTEGER in the project-schema.xml.

Ofcourse I could create a dummy ExprNode by hand that has PK = 0 and not use it 
anywhere. But I want to find the better or proper way to take care of this 
problem. Using ExprNode with PK=0 will be my last resort.

If the problem I mention is the way Torque works, then I would like to suggest a 
solution to this problem as a feature of newer releases of Torque. Thank you.

~Sarav

-- 
There are 10 kinds of people in the world,
those who know binary and those who don't.


Quoting T E Schmitz <mailreg@numerixtechnology.de>:

> I'm sorry but I can't see how the problem you describe is related to my 
> question. My Question was whether outer joins are supported or not and 
> if not, what the work-around could be.
> 
> 
> Regards,
> 
> Tarlika Elisabeth Schmitz
>

---------------------------------------------------------------------
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