Hello again,
Still trying to understand how to deal with default values defined in a
pre-existing database when using Castor. Here is another example:
I have a table defined like:
CREATE TABLE table (
...
StartDate date NOT NULL default '0000-00-00',
EndDate date NOT NULL default '0000-00-00',
InactiveIndic tinyint(1) NOT NULL default '0',
PRIMARY KEY (CourseOfTherapy_ID)
) TYPE=MyISAM;
How does Castor handle this? How do I keep it from trying to write NULL to
the table? I've tried generating classes from an XML Schema that I've
created based on this table. I've tried using the "default" attribute on a
field:
<xs:attribute name="StartDate" type="xs:date" use="optional"
default="0000-00-00" />
And using the SourceGen tool to generate the class for the table. But I get
unusable code such as:
/**
* Field _startDate
*/
private org.exolab.castor.types.Date _startDate = 0000-00-00;
and
try {
setStartDate(0000-00-00);
} catch (java.text.ParseException pe) {
throw new IllegalStateException(pe.getMessage());
}
Any suggestions on how to handle this?
Thanks,
-Tom
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev