我想將此 XML 發(fā)送到 api 服務(wù)器:XML 請(qǐng)求:<reconcile> <start_date>2018-04-08T11:02:44</start_date> <end_date>2018-04-08T11:02:44</end_date> <page>1</page></reconcile>JAXB 代碼:@XmlRootElement(name = "reconcile")@XmlAccessorType(XmlAccessType.FIELD)public class Reconcile { @XmlElement(name = "start_date") @XmlJavaTypeAdapter(LocalDateTimeXmlAdapter.class) public LocalDateTime start_date; @XmlElement(name = "end_date") @XmlJavaTypeAdapter(LocalDateTimeXmlAdapter.class) public LocalDateTime end_date; @XmlElement(name = "page") public String page;SQL查詢:public List<PaymentTransactions> transactionsByDate(LocalDateTime start_date, LocalDateTime end_date) throws Exception { String hql = "select e from " + PaymentTransactions.class.getName() + " e where e.created_at >= ? and e.created_at <= ?"; Query query = entityManager.createQuery(hql).setParameter(0, start_date).setParameter(1, end_date)); List<PaymentTransactions> paymentTransactions = (List<PaymentTransactions>) query.getResultList(); return paymentTransactions; }但是當(dāng)我提出請(qǐng)求時(shí),我得到:java.lang.IllegalArgumentException: Parameter value [2018-04-08T11:02:44] did not match expected type [java.util.Date (n/a)]在將日期值作為 SQL 查詢的參數(shù)發(fā)送之前,是否需要轉(zhuǎn)換它?或者我需要使用其他類型的日期?
參數(shù)值 [2018-04-08T11:02:44] 與預(yù)期類型
ibeautiful
2021-10-28 14:11:42