db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brycenesbitt <bry...@obviously.com>
Subject RE: Question: Torque NULL handling on insert, update
Date Mon, 29 Oct 2007 16:09:22 GMT

Yep, the docs are lacking.  I got part way there with NULL, and then backed
myself into a corner.  You can process nulls in many cases, just not all of
them.  Ones that work include:

   Criteria selectCriteria = new Criteria();
member.getMemberIdAsInt(),        Criteria.EQUAL );
   selectCriteria.add(CcsCouponPeer.RESERVATION_ID, (Object)"RESERVATION_ID
is NULL", Criteria.CUSTOM);
   List foo = CcsCouponPeer.doSelect(selectCriteria);

   updateCriteria.add(CcsCouponPeer.RESERVATION_ID , null);
   CcsCouponPeer.doUpdate(selectCriteria, updateCriteria);

But if you let the mapper update such a row, you'll get torqued.

Greg Monroe wrote:
> 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
> primitives.

View this message in context: http://www.nabble.com/Question%3A-Torque-NULL-handling-on-insert%2C-update-tf4709373.html#a13470797
Sent from the Apache DB - Torque Users mailing list archive at Nabble.com.

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message