Hello everyone, I was wondering something I just noticed.
I have this query in hibernate:
Code:
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR_OF_DAY, -12);
Query q = entityManager().createQuery("SELECT COUNT(o) FROM BuyRespPraomp o where insertTimestamp > :date ", Long.class);
q.setParameter("date", cal.getTime());
return (Long) q.getSingleResult();
The field insertTimestamp is indexed on the database.
Now, what I noticed is that this query takes a couple milliseconds if I execute it from say Toad, and as much as five seconds if I run it from my application using Hibernate.
Am I being silly and missing something obvious here?
Thanks as always,
TD