cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Øyvind Harboe" <>
Subject Handling of database NULL - default value column to modeler?
Date Wed, 20 Aug 2008 09:46:54 GMT
One way to handle database NULL (replace with default value)
is to override the CayenneDataObject get/set methods.

However, I was wondering if it would make sense to add a column
to DbEntity in the modeler for this case.

The idea is that this "documents" the behaviour in the modeler for
what happens in this case for a column. It also saves a tad of
Java boilerplate code.

I would expect the default value to behave as follows:

default value = null. Same as today.

default value != null:

- return default value upon getXxx() methods (readProperty()) when
database column contains NULL
- setProperty() w/default value upon column w/database NULL. Probably
update the database upon commit. This would cause database NULL
to be updated to default value when rewinding/submitting a form without
actually making any changes to a form(using tapestry rewinding
wording above...)
- I'm not quite sure if I have decided what to expect from Expression's.
If I search for a value in the database that is equal to the default value,
would I then expect rows w/NULL to match? Probably not.

Øyvind Harboe
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

View raw message