Re: Zero dates "0000-00-00"
Re: Zero dates "0000-00-00"
- Subject: Re: Zero dates "0000-00-00"
- From: Chuck Hill <email@hidden>
- Date: Tue, 17 Mar 2009 11:33:34 -0700
These are Java exceptions, not EOF exceptions. So this won't be
easy... Look in EOAccess at the interface EOAdaptorChannel.Delegate.
Specifically the adaptorChannelDidFetchRow method. You should be
able to implement that, look for such values, and replace them with
the null marker (or remove them, I don't recall the dictionary
contents at this level).
http://developer.apple.com/documentation/MacOSXServer/Reference/WO54_Reference/com/webobjects/eoaccess/EOAdaptorChannel.Delegate.html#adaptorChannelDidFetchRow(com.webobjects.eoaccess.EOAdaptorChannel, com.webobjects.foundation.NSMutableDictionary)
I don't recall offhand how to set the delegate. I thought there was a
notification, but I could not find it.
Chuck
On Mar 17, 2009, at 11:08 AM, Gennady Kushnir wrote:
> What is the exception and stack trace?
com.webobjects.jdbcadaptor.JDBCAdaptorException: Value '0000-00-00'
can not be represented as java.sql.Date
it shows 2 stacks...
[2009-3-17 20:59:43 MSK] <WorkerThread9> Value '0000-00-00' can not
be represented as java.sql.Dateat
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.ResultSetRow.getDateFast(ResultSetRow.java:134)
at com.mysql.jdbc.ByteArrayRow.getDateFast(ByteArrayRow.java:235)
at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2115)
at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2067)
at com.mysql.jdbc.ResultSetImpl.getObject(ResultSetImpl.java:4895)
at
com
.webobjects
.jdbcadaptor.JDBCColumn._fetchCorrectObject(JDBCColumn.java:294)
at com.webobjects.jdbcadaptor.JDBCColumn._fetchValue(JDBCColumn.java:
384)
at com.webobjects.jdbcadaptor.JDBCColumn.fetchValue(JDBCColumn.java:
372)
at com.webobjects.jdbcadaptor.JDBCChannel.fetchRow(JDBCChannel.java:
1462)
at
com
.webobjects
.eoaccess.EODatabaseChannel._fetchObject(EODatabaseChannel.java:321)
at
com
.webobjects
.eoaccess
.EODatabaseContext
._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:
3071)
at
com
.webobjects
.eoaccess
.EODatabaseContext
.objectsWithFetchSpecification(EODatabaseContext.java:3195)
at
com
.webobjects
.eoaccess.EODatabaseContext._fireFault(EODatabaseContext.java:4187)
at
com
.webobjects
.eoaccess
.EOAccessFaultHandler
.completeInitializationOfObject(EOAccessFaultHandler.java:89)
at
com.webobjects.eocontrol.EOCustomObject.willRead(EOCustomObject.java:
1172)
at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer
$
_GenericRecordBinding
.valueInObject(_EOMutableKnownKeyDictionary.java:570)
at
com
.webobjects
.eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1634)
at net.rujel.vseobuch._VOStudent.lastName(_VOStudent.java:71)
... etc (NSKeyValueCoding and appendToResponse)
and:
at com.webobjects.jdbcadaptor.JDBCColumn._fetchValue(JDBCColumn.java:
391)
at com.webobjects.jdbcadaptor.JDBCColumn.fetchValue(JDBCColumn.java:
372)
at com.webobjects.jdbcadaptor.JDBCChannel.fetchRow(JDBCChannel.java:
1462)
at
com
.webobjects
.eoaccess.EODatabaseChannel._fetchObject(EODatabaseChannel.java:321)
at
com
.webobjects
.eoaccess
.EODatabaseContext
._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:
3071)
at
com
.webobjects
.eoaccess
.EODatabaseContext
.objectsWithFetchSpecification(EODatabaseContext.java:3195)
at
com
.webobjects
.eoaccess.EODatabaseContext._fireFault(EODatabaseContext.java:4187)
at
com
.webobjects
.eoaccess
.EOAccessFaultHandler
.completeInitializationOfObject(EOAccessFaultHandler.java:89)
at
com.webobjects.eocontrol.EOCustomObject.willRead(EOCustomObject.java:
1172)
at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer
$
_GenericRecordBinding
.valueInObject(_EOMutableKnownKeyDictionary.java:570)
at
com
.webobjects
.eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1634)
at net.rujel.vseobuch._VOStudent.lastName(_VOStudent.java:71)
2009/3/17 Chuck Hill <email@hidden>:
>
> On Mar 17, 2009, at 10:48 AM, Gennady Kushnir wrote:
>
>> Hello list.
>> Is there some known hint to get rid with exception raised when
dealing
>> with zero dates in SQL?
>> I'm taking data from database maintained with a third party
program.
>> When a date is undefined that program puts "0000-00-00" into
database
>> which is acceptable for SQL but raises an exception in WO.
>> How can I make EOF treat that value normally returning null for
date
>> in corresponding EnterpriseObject?
>
> What is the exception and stack trace?
>
>
> Chuck
>
>
>> Thanks in advance
>> Gennady
>
>
> -- Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their
overall
> knowledge of WebObjects or who are trying to solve specific
problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden