| Author |
org.hibernate.exception.SQLGrammarException: could not execute query
|
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
|
|
Hi list[],
I am getting following exception :
And i am calling like this
Pl tell me where i am wrong.
|
 |
Waswani Naresh
Ranch Hand
Joined: May 01, 2008
Posts: 66
|
|
criteria.add(Restrictions.sqlRestriction(" TO_CHAR(BRCD_CRTE_TIME,'YYYYMMDD')BETWEEN '" +fromDate+ "' AND '"+ toDate+"'" ));
There is no space before 'BETWEEN'. Try giving a space before it.
Regards,
Naresh Waswani
|
Naresh Waswani
|
 |
joy b chakravarty
Ranch Hand
Joined: May 16, 2011
Posts: 62
|
|
From what I understand the problem doesn't lie in the Between cluase
If you look at the generated query you have something like this
select this_.BRCD_DLR_NO as y0_, this_.BRCD_PART_NO as y1_,
...
where TO_CHAR(BRCD_CRTE_TIME,'YYYYMMDD')BETWEEN '20110728' AND '20110729' and y1_=?
This should have been this_.BRCD_PART_NO = ?
i think use of Projections is causing this to happen..
|
Cheers, Joy [SCJP 1.4, SCBCD 5.0]
get high on alcohol, algorithm or both
|
 |
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
|
|
Thanks for reply,
I solve the problem as i use alias name like this.
|
 |
 |
|
|
subject: org.hibernate.exception.SQLGrammarException: could not execute query
|
|
|