I am using Apache Camel framework of java in which I am fetching the data from oracle db with a column of type timestamp
. When I am trying to map this to variable of type java.util.Date
, it is throwing the following error mentioned.
Caused by: java.lang.IllegalArgumentException:
Could not find a suitable setter for property lastupdated as there isn't a setter method with same type oracle.sql.TIMESTAMP nor type conversion possible:
No type converter available to convert from type oracle.sql.TIMESTAMP to the required type java.util.Date with value "2022-11-16 19:04:27.067"
Can anyone help me with this?
I tried to use the following datatypes of java-
java.util.Date
oracle.sql.TIMESTAMP
java.sql.Timestamp
But still the error is same.
create a camel convertor and add it camel context annotation can be change for spring + camel or quarkus + camel it is basic camel annotation
@Converter(generateLoader = true)
public class DateConvertor {
@Converter
public static java.sql.Timestamp toTimeStamp(oracle.sql.TIMESTAMP timestamp) {
return timestamp.timestampValue()
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.