Hi,

Check your class. I think you'll find that Application.releaseDate is a
java.sql.Date and *not* a java.util.Date.

The error message is saying "com.itservices.woc.data.Application has an
attribute releaseDate with a type of java.sql.Date, but I have a value of
java.util.Date".

JavaDate2SqlDateFieldConversion converts betwen jdbc dates (java.sql.Date)
into java dates (java.util.Date) when reading from the datase, and the
reverse when writing to the database.

Either 
a) Don't use the conversion or
b) change the attribute to be java.util.Date

Cheers,

Charles.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 18 November 2003 08:43
> To: [EMAIL PROTECTED]
> Subject: Problem with dates conversion
> 
> 
> Hello,
> 
> Trying to use the field conversion:
> 
> I have a class "Application" that has an attribute 
> "releaseDate" to store a date (no time).
> In my database (MS SQL) the type is: datetime.
> In OJB repository the jdbc-type is: DATE.
> In my java code I use the class java.util.Date.
> 
> I added the line below in OJB repository:
> conversion="org.apache.ojb.broker.accesslayer.conversions.Java
> Date2SqlDateFieldConversion"
> 
> But this produces an error:
> 
> [DEFAULT] ERROR: Error in operation [set] of object 
> [PersistentFieldPropertyImpl], java.lang.IllegalArgumentException
> [DEFAULT] ERROR: Declaring class [com.itservices.woc.data.Application]
> [DEFAULT] ERROR: Property Name [releaseDate]
> [DEFAULT] ERROR: Property Type [java.sql.Date]
> [DEFAULT] ERROR: anObject was class 
> [com.itservices.woc.data.Application]
> [DEFAULT] ERROR: aValue was class [java.util.Date]
> org.apache.ojb.broker.PersistenceBrokerException: Unable to 
> build object instance :class com.itservices.woc.data.Application
>       at 
> org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildWi
> thReflection(Unknown Source)
>       at 
> org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObj
> ectFrom(Unknown Source)
>       at 
> org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResu
> ltSet(Unknown Source)
>       at 
> org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source)
>       etc...
> 
> Could you help me?
> Thanks
> Sylvain
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


___________________________________________________________
HPD Software Ltd. - Helping Business Finance Business
Email terms and conditions: www.hpdsoftware.com/disclaimer 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to