This seems pretty cool. The problem is that I am working under another developer
that knows hibernate a lot more than I do. He has provided an API in which I can create
my own hql queries and use them in my programs. I no means (I think) to do any session.createQuery() stuff. MY basic problem is this. I need to figure out how to
find persisted objects that are older than hour (+ other criteria) so I can delete them.
Using the api I have I can do deleteObject("from myObject o where id =?) with no
problem. My problem is how to select on a timestamp field minus 1 hour and represent that in an hql query. Thanks Guys!
tcollins wrote:
Try something like this....
Code:
Date d = new Date();
Timestamp ts = new Timestamp(d.getTime());
String hqlString = "select obj from Object as obj where obj.TimestampField < :timeStampField";
Query query = session.createQuery(hqlString);
query.setTimestamp("timeStampField",ts);
List list = query.list();