我正在使用java的Apache框架,在该框架中,我使用类型为timestamp的列从oracle获取数据。当我试图将它映射到java.util.Date类型的变量时,它会抛出下面提到的错误。
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"有人能帮我吗?
我尝试使用以下java数据类型-
java.util.Dateoracle.sql.TIMESTAMPjava.sql.Timestamp但错误仍然是一样的。
发布于 2022-11-25 18:21:41
创建一个camel转换器并添加它,camel上下文注释可以更改为spring + camel或quarkus + camel,这是基本的camel注释。
@Converter(generateLoader = true)
public class DateConvertor {
@Converter
public static java.sql.Timestamp toTimeStamp(oracle.sql.TIMESTAMP timestamp) {
return timestamp.timestampValue()
}
}https://stackoverflow.com/questions/74543157
复制相似问题