如何从 JPA 中的日期列表中查询?

How to query from a date list in JPA?

我正在尝试查询 dates.So 列表中发生的所有交易 我尝试了以下功能:

 public Collection<Transaction> getTransactionsByDates(short status,List<Date> dates){
   Query query = em.createQuery(" SELECT a FROM Transaction a where a.Status=:status and a.dates in :transactionDate");
   query.setParameter("status", status);
   query.setParameter("dates", dates);
   return (Collection<Transaction>) query.getResultList();
}

但这会引发

的错误

org.hibernate.QueryException: could not resolve property: dates

我在 JPA 中查询正确吗?

感谢任何帮助!

我觉得有错字

public Collection<Transaction> getTransactionsByDates(short status,List<Date> dates){
   Query query = em.createQuery(" SELECT a FROM Transaction a where a.Status=:status and a.dates in :transactionDate");
   query.setParameter("status", status);
   query.setParameter("transactionDate", dates);
   return (Collection<Transaction>) query.getResultList();
}

替换行

query.setParameter("dates", dates);

query.setParameter("transactionDate", dates);

错字问题