I'm using MyBatis 3.2, and want to map Oracle DATE
data type to Java org.joda.time.DateTime
data type.
Here is my configuration:
<resultMap id="something" type="com.myself.SomeClass">
<result property="creationDate" column="CREATION_DATE" javaType="org.joda.time.DateTime" />
</resultMap>
But I get following error:
Caused by: org.apache.ibatis.builder.BuilderException
: Error parsing SQL Mapper Configuration.
Cause : org.apache.ibatis.builder.BuilderException
: Error parsing Mapper XML.
Cause : java.lang.IllegalStateException
: No typehandler found for property creationDate
Is my configuration correct? Or is it caused by my Oracle data type is DATE
instead of DATETIME
? Does MyBatis support joda DateTime?
I think you need to use TypeResolver to handle JodaTime to Oracle DateTime. I had experience with this with MyBatis with MySQL and you might use this is a guide that might help you with your issue.
I used this github project as guide on how to use TypeResolver: https://github.com/LukeL99/joda-time-mybatis
And in one of my mappers, I have this code:
The org.joda.time.mybatis.handlers.DateTimeTypeHandler is class from the github project I posted.
I hope this would help guide you.