You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wicketshafi <sm...@gmail.com> on 2007/12/03 13:07:11 UTC
Pagination Probelm with date_Sub(): MYSQL +HIberante
I am using wicket ,hibernate ...
Use Case: getting all the records which are created within 30 days....
DATE_SUB(CURDATE(),INTERVAL 30 DAY) is giving error in hibernate....
can any body help me to solve this issue ....
if you know hibernate date functions regarding this issue..
could you let me know once...
regards
Shafi
--
View this message in context: http://www.nabble.com/Pagination-Probelm-with-date_Sub%28%29%3A-MYSQL-%2BHIberante-tf4936098.html#a14128684
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Pagination Probelm with date_Sub(): MYSQL +HIberante
Posted by Igor Vaynberg <ig...@gmail.com>.
gah, next time please dont answer...
-igor
On Dec 3, 2007 5:00 AM, Roy van Rijn <ro...@gmail.com> wrote:
> Not really a Wicket question... but as long as we answer :)
>
> You can just use Date objects in Hibernate:
>
> Criteria criteria = session.createCriteria(Sale.class);
> if (startDate != null) {
> criteria.add(Expression.ge("date",startDate);
> }
> List results = criteria.list();
>
> And in HQL you can do:
>
> Map parameters = new HashMap();
> StringBuffer queryBuf = new StringBuffer("from Sale s ");
> boolean firstClause = true;
>
> if (startDate != null) {
> queryBuf.append(firstClause ? " where " : " and ");
> queryBuf.append("s.date >= :startDate");
> parameters.put("startDate",startDate);
> firstClause = false;
> }
>
> (examples from: http://www.javalobby.org/articles/hibernatequery102/)
>
> Roy
>
>
> On 12/3/07, wicketshafi <sm...@gmail.com> wrote:
> >
> >
> > I am using wicket ,hibernate ...
> >
> > Use Case: getting all the records which are created within 30 days....
> >
> > DATE_SUB(CURDATE(),INTERVAL 30 DAY) is giving error in hibernate....
> > can any body help me to solve this issue ....
> >
> > if you know hibernate date functions regarding this issue..
> > could you let me know once...
> >
> > regards
> > Shafi
> >
> >
> >
> >
> > --
> > View this message in context: http://www.nabble.com/Pagination-Probelm-with-date_Sub%28%29%3A-MYSQL-%2BHIberante-tf4936098.html#a14128684
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Pagination Probelm with date_Sub(): MYSQL +HIberante
Posted by Roy van Rijn <ro...@gmail.com>.
Not really a Wicket question... but as long as we answer :)
You can just use Date objects in Hibernate:
Criteria criteria = session.createCriteria(Sale.class);
if (startDate != null) {
criteria.add(Expression.ge("date",startDate);
}
List results = criteria.list();
And in HQL you can do:
Map parameters = new HashMap();
StringBuffer queryBuf = new StringBuffer("from Sale s ");
boolean firstClause = true;
if (startDate != null) {
queryBuf.append(firstClause ? " where " : " and ");
queryBuf.append("s.date >= :startDate");
parameters.put("startDate",startDate);
firstClause = false;
}
(examples from: http://www.javalobby.org/articles/hibernatequery102/)
Roy
On 12/3/07, wicketshafi <sm...@gmail.com> wrote:
>
>
> I am using wicket ,hibernate ...
>
> Use Case: getting all the records which are created within 30 days....
>
> DATE_SUB(CURDATE(),INTERVAL 30 DAY) is giving error in hibernate....
> can any body help me to solve this issue ....
>
> if you know hibernate date functions regarding this issue..
> could you let me know once...
>
> regards
> Shafi
>
>
>
>
> --
> View this message in context: http://www.nabble.com/Pagination-Probelm-with-date_Sub%28%29%3A-MYSQL-%2BHIberante-tf4936098.html#a14128684
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org