Hi,
so I've digged deeper in the default value issue and it
turned out not to be a problem with default values themselves...
but a problem with nullability.

The attribute building code in JDCB datastores, 2.4.x series,
has an interesting comment:

int min = nillable ? 0 : 1;
//JD: We would like to set the nillable flag properly here,
// but there is a lot of code that sets the value of an
// attribute to be null while building a feature, think of feature
// readers that have to copy content, so we always set it to true,
// perhaps with the new feature model things like this will be fished
// out
return AttributeTypeFactory.newAttributeType(columnName, type, true, 
null, null, null, min, 1 );

The current new code looks like:

AttributeTypeBuilder atb = new AttributeTypeBuilder();
atb.setName(columnName);
atb.setBinding(type);
atb.setMinOccurs(min); (*)
atb.setMaxOccurs(1);   (*)
atb.setNillable(nillable); (*)
return atb.buildDescriptor(columnName);

The irony is, the lines marked with (*) have been introduced
by yours truly some 20 days ago, so I'm really getting crazy
on a bug I introduced myself.
Sometimes justice shows up and makes you pay for your mistakes ;)

Yet, if my current analisys is correct, forcing an attribute
to be nullable is really needed only for primary key
fields that are showing up as attributes... knowing the fid
mapper when building the attribute would allow to play
the nullable hack only where needed. What do you think?

Getting back to the default value issue, it's a red herring,
the old feature model did set default values on non nullable
values already. Not doing so breaks some tests in the MIF
module (that's the first example I found, at least, but
I guess we'd find others by digging more).

Cheers
Andrea







-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to