db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: Question: Torque NULL handling on insert, update
Date Mon, 29 Oct 2007 13:55:15 GMT
Patrick is correct, primitives don't allow for NULL values
to be used.  FYI, there is also a defaultJavaType attribute
on the Database element that can be used to change all the 
getter/setter methods to objects.

FWIW, primitive is the "default" because it's generally 
more convenient for code writers to have native types 
than creating native objects all the time.  

That said, you're right in that how to deal with NULLs 
is not well documented.  In addition, one of the ToDo's
for 4.0 is to improve on how these are handled (e.g. have
an isNull() test and a way to set a null value if using
primatives.

> -----Original Message-----
> From: patrick.carl@web.de [mailto:patrick.carl@web.de] 
> Sent: Monday, October 29, 2007 9:05 AM
> To: Apache Torque Users List
> Subject: Re: Question: Torque NULL handling on insert, update
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I think that null values are not supported for primitive types.
> But you can change your schema to use objects instead of 
> primitive types
> for certain colums by setting the javaType attribute to object.
> See
> http://db.apache.org/torque/releases/torque-3.3/generator/sche
> ma-reference.html
> within the column section.
> 
> Patrick
> 
> brycenesbitt schrieb:
> > But SQL has an additional state:: null.  And there's a 
> difference between
> > calling a torque set method, and not calling a set method.  
> So the question
> > remains: is Torque's behavior documented?  Does Torque 
> support null column
> > values for primitive type columns (e.g. columns other than 
> String and
> > NumberKey)?
> > 
> > 
> > 
> >> What you find here is the Java default behavior. A int has 
> a default
> >> value of 0. It can not be set to null. Therefore when the value is
> >> initialized and no other value is given it is set to 0. 
> Same applies to
> >> long.
> >>
> > 
> 
> - --
> Patrick Carl
> mailto:patrick@carl.it                                http://carl.it
> GnuPG-Fingerprint: 3599 02CF 0419 BCA6 6BAC 4B53 DB7C 1897 451C F498
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> 
> iD8DBQFHJdp723wYl0Uc9JgRAj4hAJ4gtkd7rU/N2vPUEd5jwZGbj91BKwCgvl1x
> AFOghNKPt0YNyMSjX2EYabU=
> =1MN0
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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