我有以下路线从 postgresql 获取数据,但日期对象为空。它无法映射该值
我的路线如果跟随
<route id="instrumentqueryshortsell">
<from uri="direct:restinstumentshortsell"/>
<bean ref="inConverter" method="convert"/>
<setBody>
<simple>select instrumentId as instrument_Id ,amount,easytoborrow as easy_To_Borrow,hardtoborrow as hard_To_Borrow ,datetime as date from instrument_short_sell where instrumentId in (${body}) </simple>
</setBody>
<log message="Running following query ${body} " loggingLevel="DEBUG"/>
<to uri="jdbc:dataSource?useHeadersAsParameters=true&outputClass=<packagename?.InstrumentShortSell" />
</route>
我的 Pojo 课看起来像
import java.time.LocalDateTime;
import org.joda.time.DateTime;
public class InstrumentShortSell {
private String instrumentId;
private long amount;
private boolean easyToBorrow;
private boolean hardToBorrow;
private DateTime date;
public DateTime getDate() {
return date;
}
public void setDate(DateTime date) {
this.date = date;
}
public String getInstrumentId() {
return instrumentId;
}
public void setInstrumentId(String instrumentId) {
this.instrumentId = instrumentId;
}
public long getAmount() {
return amount;
}
public void setAmount(long amount) {
this.amount = amount;
}
public boolean isEasyToBorrow() {
return easyToBorrow;
}
public void setEasyToBorrow(boolean easyToBorrow) {
this.easyToBorrow = easyToBorrow;
}
public boolean isHardToBorrow() {
return hardToBorrow;
}
public void setHardToBorrow(boolean hardToBorrow) {
this.hardToBorrow = hardToBorrow;
}
}
SQL 模式是
CREATE TABLE instrument_short_sell (
instrumentId serial ,
amount INTEGER,
easytoborrow boolean,
hardtoborrow boolean,
datetime timestamp with time zone
) ;
我无法映射 jodadatetime 并且每次它都为空。请帮我看看我们如何在骆驼 jdbc 中映射它