Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

Below is the hibernate query I have written:

public List<GroupTweetOrder> fetchTodayGroupOrder(Date date) {
    Session session = getSessionFactory().getCurrentSession();
    DateTime todayAtMidnight = new DateTime().withTimeAtStartOfDay();
    DateTime tomorrowAtMidnight = todayAtMidnight.plusDays(1);
    Query query = session
        .getNamedQuery("findUsersOrder")
        .setTimestamp("todayAtMidnight", todayAtMidnight.toDate())
        .setTimestamp("tomorrowAtMidnight", tomorrowAtMidnight.toDate());
    List<GroupTweetOrder> usersOrder = query.list();
    return usersOrder;
}

This code is throwing exceptions, can we use some other ways to achieve the same means of recording from the database for today's date ?

share|improve this question

closed as off-topic by Marc-Andre, unholysampler, BeetDemGuise, syb0rg, Glenn Rogers Jun 27 at 14:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions containing broken code or asking for advice about code not yet written are off-topic, as the code is not ready for review. Such questions may be suitable for Stack Overflow or Programmers. After the question has been edited to contain working code, we will consider reopening it." – Marc-Andre, unholysampler, BeetDemGuise, syb0rg, Glenn Rogers
If this question can be reworded to fit the rules in the help center, please edit the question.

    
This code is throwing exceptions so it's not working, right ? –  Marc-Andre Jun 26 at 14:28
    
yes brother write –  subodh Jun 27 at 5:02
add comment