db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <Fisc...@seitenbau.net>
Subject Re: Torque tries to insert 0 into nullable Foreign Key
Date Tue, 07 Dec 2004 10:37:57 GMT





Hi Daniel,

> Hi Sarav,
>
> > Use this attribute in the database tag.
> > defaultJavaType="object"
>
> thank you very much. I would prefer primitives for my numbers,
> especially the ids, but that is o.k. for me. Everything  works,
> with one exception:
>
> I have a foreign key that is "NOT NULL", but has a default value.
> An INSERT statement generated by Torque explicitly tries to insert
> '', which is converted to NULL by Orcale. That will be rejected by
> the DB in the upper case (NOT NULL with default). I have to insert
> the default in my Java code :-|
>

This seems to be another non-standard behaviour of oracle. My guess is that
this problem has to be addressed in the village library.

>
> I think about editing the templates to modify the buildCriteria
> method according to my earlier post (only add a column to the
> criteria object if it is not 0 and the col is declared as INTEGER/
> number and not required).
>
> Can that approach be useful for Torque in general? It would
> disallow the value 0 as foreign key.
>

I did not have time yet to look into the problem in detail, but it seems to
me that disallowing the value zero as a foreign key is not an option for
Torque in  general. It is not a clean solution, the problem is just
"transferred to the other side".

   Thomas


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