-->
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.  [ 2 posts ] 
Author Message
 Post subject: Help - SQL to Criteria
PostPosted: Wed Aug 12, 2009 12:42 pm 
Newbie

Joined: Wed Aug 12, 2009 12:34 pm
Posts: 2
Friends,

I need a help to transform the following query (in sql) to a query criteria in pure, making it independent of the database.

Already tried and tried almost everything, if someone has something that can help me, thanks.

criteria
.add(Restrictions
.sqlRestriction(
"(str(datepart(hour, dt_registro)) +str(datepart(minute, dt_registro))) "
+ "between (str((?))+str((?))) and (str((?))+str((?)))",
new Integer[] { horaInicio, minutoInicio,
horaFim, minutoFim }, new Type[] {
Hibernate.INTEGER,
Hibernate.INTEGER,
Hibernate.INTEGER,
Hibernate.INTEGER }));


*The idea and that a date field in the database has its time within the range suggested.
*I can't do in HQL.


Top
 Profile  
 
 Post subject: Re: Help - SQL to Criteria
PostPosted: Thu Aug 13, 2009 4:58 am 
Beginner
Beginner

Joined: Wed Dec 10, 2008 5:59 am
Posts: 47
Quote:
I need a help to transform the following query (in sql) to a query criteria in pure, making it independent of the database.


Could you please also provide the SQL query you mention?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.