You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by MrNobody <to...@pepsi.com> on 2008/02/08 17:55:09 UTC

iBATIS no longer allows me to set java.sql.Timestamp property

I had suffered a hard drive meltdown a couple of weeks ago and had to restore
a project I am working on which involves loading objects from an Oracle
database using iBATIS.

Now I finally got the database and the application back up and running (the
database I was using to develop on was also a local instance) but when I run
my project iBATIS is complaining about setting the Timestamp properties on
my result class. 

--- Cause: java.lang.RuntimeException: Error setting property
'setActionDate' of 'com.pbg.roadnet.bo.WorkerAction@d8ca48'.  Cause:
java.lang.IllegalArgumentException: argument type mismatch; nested exception
is com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in com/pbg/roadnet/dao/sqlmap/WorkerAction.xml.  
--- The error occurred while applying a result map.  
--- Check the selectActionsWithinRange-AutoResultMap.  
--- The error happened while setting a property on the result object.  

the "ActionDate" property on my java object- which was restored from my old
project and is 100% identical to when it ran fine before- is a
java.sql.Timestamp field.

So what could suddenly cause this to fail?

I thought of two possibilities: one is that the driver I am using now is not
the same (unfortunately I did not backup the driver I was using before so I
just downloaded the latest Oracle 10g driver - ojdbc14.jar). I could maybe
start trying some older drivers if you think this is the most likely cause.

the second is that maybe I did not use the right column type on the database
tables. See, while the database version itself is exactly the same (Oracle
10g Express Edition) the tables had to be rebuilt not from scripts matching
my old schema but by reverse engineering them based on my sql map files
(basically looked at what columns I was selected, their types, and created
tables to match). So the bottom line with this is, I cant remember if I used
DATE or TIMESTAMP as the Oracle column type. I am very sure though, that I
actually used DATE, which is what I have now. But for the hell of it I tried
TIMESTAMP and still iBATIS is spitting that error at me.

Do you have any ideas what could be causing this sudden conflict?
-- 
View this message in context: http://www.nabble.com/iBATIS-no-longer-allows-me-to-set-java.sql.Timestamp-property-tp15359372p15359372.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


RE: iBATIS no longer allows me to set java.sql.Timestamp property

Posted by Sundar Sankaranarayanan <Su...@phoenix.edu>.
I am right using java.sql.Date for a Date mapping and it works fine for
me.. Did u try and restart the servers after you had committed the
change to the database (Just a wild guess to the problem)
 
Regards
Sundar

________________________________

From: Nathan Maves [mailto:nathan.maves@gmail.com] 
Sent: Friday, February 08, 2008 10:56 AM
To: user-java@ibatis.apache.org
Subject: Re: iBATIS no longer allows me to set java.sql.Timestamp
property


I have never found a case where using the java.util.Date for my Java
object would not work. I would suggest using that on the Java side.  


On Feb 8, 2008 9:55 AM, MrNobody <to...@pepsi.com> wrote:



	I had suffered a hard drive meltdown a couple of weeks ago and
had to restore
	a project I am working on which involves loading objects from an
Oracle
	database using iBATIS.
	
	Now I finally got the database and the application back up and
running (the
	database I was using to develop on was also a local instance)
but when I run
	my project iBATIS is complaining about setting the Timestamp
properties on
	my result class.
	
	--- Cause: java.lang.RuntimeException: Error setting property
	'setActionDate' of 'com.pbg.roadnet.bo.WorkerAction@d8ca48'.
Cause:
	java.lang.IllegalArgumentException: argument type mismatch;
nested exception
	is com.ibatis.common.jdbc.exception.NestedSQLException:
	--- The error occurred in
com/pbg/roadnet/dao/sqlmap/WorkerAction.xml.
	--- The error occurred while applying a result map.
	--- Check the selectActionsWithinRange-AutoResultMap.
	--- The error happened while setting a property on the result
object.
	
	the "ActionDate" property on my java object- which was restored
from my old
	project and is 100% identical to when it ran fine before- is a
	java.sql.Timestamp field.
	
	So what could suddenly cause this to fail?
	
	I thought of two possibilities: one is that the driver I am
using now is not
	the same (unfortunately I did not backup the driver I was using
before so I
	just downloaded the latest Oracle 10g driver - ojdbc14.jar). I
could maybe
	start trying some older drivers if you think this is the most
likely cause.
	
	the second is that maybe I did not use the right column type on
the database
	tables. See, while the database version itself is exactly the
same (Oracle
	10g Express Edition) the tables had to be rebuilt not from
scripts matching
	my old schema but by reverse engineering them based on my sql
map files
	(basically looked at what columns I was selected, their types,
and created
	tables to match). So the bottom line with this is, I cant
remember if I used
	DATE or TIMESTAMP as the Oracle column type. I am very sure
though, that I
	actually used DATE, which is what I have now. But for the hell
of it I tried
	TIMESTAMP and still iBATIS is spitting that error at me.
	
	Do you have any ideas what could be causing this sudden
conflict?
	--
	View this message in context:
http://www.nabble.com/iBATIS-no-longer-allows-me-to-set-java.sql.Timesta
mp-property-tp15359372p15359372.html
	Sent from the iBATIS - User - Java mailing list archive at
Nabble.com.
	
	



Re: iBATIS no longer allows me to set java.sql.Timestamp property

Posted by Nathan Maves <na...@gmail.com>.
I have never found a case where using the java.util.Date for my Java object
would not work. I would suggest using that on the Java side.

On Feb 8, 2008 9:55 AM, MrNobody <to...@pepsi.com> wrote:

>
> I had suffered a hard drive meltdown a couple of weeks ago and had to
> restore
> a project I am working on which involves loading objects from an Oracle
> database using iBATIS.
>
> Now I finally got the database and the application back up and running
> (the
> database I was using to develop on was also a local instance) but when I
> run
> my project iBATIS is complaining about setting the Timestamp properties on
> my result class.
>
> --- Cause: java.lang.RuntimeException: Error setting property
> 'setActionDate' of 'com.pbg.roadnet.bo.WorkerAction@d8ca48'.  Cause:
> java.lang.IllegalArgumentException: argument type mismatch; nested
> exception
> is com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in com/pbg/roadnet/dao/sqlmap/WorkerAction.xml.
> --- The error occurred while applying a result map.
> --- Check the selectActionsWithinRange-AutoResultMap.
> --- The error happened while setting a property on the result object.
>
> the "ActionDate" property on my java object- which was restored from my
> old
> project and is 100% identical to when it ran fine before- is a
> java.sql.Timestamp field.
>
> So what could suddenly cause this to fail?
>
> I thought of two possibilities: one is that the driver I am using now is
> not
> the same (unfortunately I did not backup the driver I was using before so
> I
> just downloaded the latest Oracle 10g driver - ojdbc14.jar). I could maybe
> start trying some older drivers if you think this is the most likely
> cause.
>
> the second is that maybe I did not use the right column type on the
> database
> tables. See, while the database version itself is exactly the same (Oracle
> 10g Express Edition) the tables had to be rebuilt not from scripts
> matching
> my old schema but by reverse engineering them based on my sql map files
> (basically looked at what columns I was selected, their types, and created
> tables to match). So the bottom line with this is, I cant remember if I
> used
> DATE or TIMESTAMP as the Oracle column type. I am very sure though, that I
> actually used DATE, which is what I have now. But for the hell of it I
> tried
> TIMESTAMP and still iBATIS is spitting that error at me.
>
> Do you have any ideas what could be causing this sudden conflict?
> --
> View this message in context:
> http://www.nabble.com/iBATIS-no-longer-allows-me-to-set-java.sql.Timestamp-property-tp15359372p15359372.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>