org.hibernate.HibernateException: ordinal parameter mismatch

Hibernate JIRA | Marc Lustig | 1 decade ago
  1. 0

    Genesys Info Mart 7.6.x Release Note

    genesys.com | 1 year ago
    org.hibernate.HibernateException: ordinal parameter mismatch
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Hibernate filters with list parameter and with JPA

    Stack Overflow | 1 month ago | drenda
    org.hibernate.HibernateException: Undefined filter parameter [localita]
  4. 0

    Hibernate can't handle CTE, so to make a CTE work, I have to create a class with subselect: <class name="foo"> <subselect><![CDATA[ select a.columnA from TableA a where a.columnB = ? ]]></subselect> . . . </class> Then in my code: List result=session.createQuery("from foo").setParameter(0,"baa").list(), it always report error: Exception in thread "main" java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based! at org.hibernate.engine.query.ParameterMetadata.getOrdinalParameterDescriptor(ParameterMetadata.java:55) at org.hibernate.engine.query.ParameterMetadata.getOrdinalParameterExpectedType(ParameterMetadata.java:61) at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:382) at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:362) at com.ibm.dztest.businesslogic.TestSQL.main(TestSQL.java:48) If I change the positioned parameter to named parameter, then the problem is: Exception in thread "main" org.hibernate.HibernateException: could not locate named parameter [id] at org.hibernate.engine.query.ParameterMetadata.getNamedParameterDescriptor(ParameterMetadata.java:75) at org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:81) at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:390) at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:376) at com.ibm.dztest.businesslogic.TestSQL.main(TestSQL.java:49) If I put a query without parameter in <subselect>, everything works fine.

    Hibernate JIRA | 1 decade ago | david zhang
    org.hibernate.HibernateException: could not locate named parameter [id]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.HibernateException

      ordinal parameter mismatch

      at org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata()
    2. Hibernate
      AbstractSessionImpl.createQuery
      1. org.hibernate.engine.query.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:214)
      2. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:94)
      3. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53)
      4. org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
      5. org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108)
      6. org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
      6 frames