嗨,大家好我真的坚持这个
我有一个约会表,我必须搜索以查看是否在我可以做的设定时间之间使用约会但是当我尝试添加搜索名为的表的功能时 USER_APPOINTMENT与Appointment映射为多对多关系作为目标是我需要搜索USER_APPOINTMENT中的用户是否在约会中有约会
public List<Appointment> appointmentRangeSearch(Date startdatetime, Date endDate) {
Query q = em.createQuery("SELECT u FROM Appointment U WHERE u.startDatetime BETWEEN :date1 AND :date2 AND WHERE u.USERS_APPOINTMENT LIKE :search");
q.setParameter("search", "%" + searchString + "%");
q.setParameter("date1", startdatetime, TemporalType.TIMESTAMP);
q.setParameter("date2", endDate, TemporalType.TIMESTAMP);
return q.getResultList();
}