-->
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.  [ 1 post ] 
Author Message
 Post subject: ordinal parameter mismatch ?
PostPosted: Sun Jan 27, 2008 9:55 am 
Newbie

Joined: Fri Jan 25, 2008 12:44 pm
Posts: 7
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.1


I 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]

_________________
Yohan Liyanage


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

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.