-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Datum als Selektionskriterium
PostPosted: Wed Apr 19, 2006 7:04 am 
Newbie

Joined: Wed Nov 16, 2005 10:58 am
Posts: 10
Hallo,

wie frage ich folgendes per HQL und/oder Criterias ab??


SELECT * FROM REQUESTS WHERE DATE(TIMESTAMP)=CURRENT
DATE - 30 DAYs


Danke


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 9:47 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
Ich würde mal auf folgendes Konstrukt tippen (sofern timestamp in deinem objekt modell ein Date ist)

Calendar cal = new GregorianCalendar();
cal.roll(Calendar.DATE, -30);
Date myDate = cal.getTime();
Query q = session.createQuery("from Request where timestamp = :tstamp");
q.setDate("tstamp", myDate);

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 11:22 am 
Newbie

Joined: Wed Nov 16, 2005 10:58 am
Posts: 10
Danke für den Tipp, jetzt klappt es!

v.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.