db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vitzethum, Daniel" <Daniel.Vitzet...@gigatronik.com>
Subject AW: Torque tries to insert 0 into nullable Foreign Key
Date Tue, 07 Dec 2004 10:07:00 GMT
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 :-|

> There is a variant of this that can be used for a single table. Check
> out the mail archives.

Torque's database.dtd answers quickly:

  <!ELEMENT column (inheritance*)>
  <!ATTLIST column
    (...)
    javaType (object|primitive) #IMPLIED
    (...)
  >

Anyway, setting the 'object' type just for some columns is not
applicable for me as there are to many relationships that have to
be considered.


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.


Greetings,

Daniel

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