SearchBookingByTimeStamp() { Calendar btime = Calendar.getInstance(); btime.set(2012, 10, 11, 7, 30, 00); //This time is already inserted, trying to find it /* My Query */ TypedQuery<Booking> query = em.createQuery( "SELECT b FROM Booking b WHERE b.btime = :btime", Booking.class) .setParameter("btime", btime, TemporalType.TIMESTAMP); }
@Entity public class Booking { @Temporal(TemporalType.TIMESTAMP) Calendar btime; }
I'm trying to search for the exact timestamp I persisted. This is a snippet of what I'm trying accomplish (won't compile of course). My resultlist from my query gets zero results. I want to search for objects by exact timestamps.