I get HibernateException : ordinal parameter mismatch when I try to execute the following query :
Code:
select b.url, count(b.url) from Bookmark b group by b.url order by count(b.url) desc, b.timestamp desc where b.timestamp between ? and ?
However, the following version (without where clause) works fine :
Code:
select b.url, count(b.url) from Bookmark b group by b.url order by count(b.url) desc, b.timestamp desc
I used the HibernateTools for Eclipse and tested it by passing parameters of type 'timestamp' with the proper format.
What is wrong in my HQL ?
I am attaching the mapping files and other information below.
Hibernate version: 3.2.5 Mapping documents:Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.netmarks.model">
<class lazy="false" name="Bookmark" table="Bookmark">
<id access="field" column="BookmarkID" name="id" type="long">
<generator class="native" />
</id>
<property column="Url" generated="never" lazy="false" name="url"
type="string" />
<property access="field" column="GenTime" generated="never"
insert="false" lazy="false" name="timestamp" type="timestamp"
update="false" />
<property column="Comment" generated="never" lazy="false"
name="comment" type="string" />
<set lazy="false" name="tags" sort="unsorted"
table="Bookmark_Tag">
<key column="BookmarkID" />
<element column="Tag" not-null="true" type="string" />
</set>
<many-to-one class="org.netmarks.model.User" column="UserID"
lazy="false" name="owner" />
</class>
</hibernate-mapping>
Name and version of the database you are using: MySQL 5.1I saw a JIRA Issue raised at
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423. Does this has any relationship to my problem?
Thanks.
[/code]