Advertisement
Guest User

Untitled

a guest
Dec 12th, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. DAO:
  2. /**
  3. * Returns the appointment blocks corresponding to the given date and location.
  4. *
  5. * @param date the date to filter by.
  6. * @param location the location to filter by.
  7. * @return the appointment blocks that is on the given date and location.
  8. */
  9. @Override
  10. @Transactional(readOnly = true)
  11. public List<AppointmentBlock> getAppointmentBlocks(Date fromDate, Date toDate, Location location) {
  12. Criteria criteria = sessionFactory.getCurrentSession().createCriteria(AppointmentBlock.class);
  13. if (location != null)
  14. criteria.add(Restrictions.eq("location", location));
  15. if (fromDate != null)
  16. criteria.add(Restrictions.ge("startDate", fromDate));
  17. if (toDate != null)
  18. criteria.add(Restrictions.le("endDate", toDate));
  19. return criteria.list();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement