1 Reply Latest reply on May 16, 2011 6:26 AM by Adam Warski

    [Hibernate 3.5.6] : Ordinal parameter mismatch

    mlo Newbie

      Hello everybody.

       

      We recently move from hibernate 2.1 to hibernate 3.5.6.

       

      Unfortunately, this query doesn't work anymore :

       

       

       

      "select paramResult from ParameterResult paramResult "
                + "inner join paramResult.internalMonitoringParameter "
                + "left join paramResult.internalCheckingCondition "
                + "where paramResult.measureDate >= ? and paramResult.internalMonitoringParameter.id = ? "
                + "order by paramResult.measureDate desc limit ?";
      
      

       

      This query fails with :

       

       

           [exec] Caused by: org.hibernate.HibernateException: ordinal parameter mismatch
           [exec]     at org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:299) [:3.5.6-Final]
           [exec]     at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:121) [:3.5.6-Final]
           [exec]     at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) [:3.5.6-Final]
           [exec]     at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:98) [:3.5.6-Final]
           [exec]     at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) [:3.5.6-Final]
           [exec]     at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) [:3.5.6-Final]
           [exec]     at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1760) [:3.5.6-Final]
           [exec]     at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:914) [:3.0.5.RELEASE]
           [exec]     at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:1) [:3.0.5.RELEASE]
           [exec]     at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) [:3.0.5.RELEASE]
           [exec]     ... 51 more
      

       

       

      Is my query wrong?

      Or, is there any work around for this??

       

      Any tips will be greatly appreciated

       

       

      Thanks !