java.lang.IndexOutOfBoundsException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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.
    via by david zhang,
  • a hibernate bug?
    via Stack Overflow by Crystal Cat
    ,
  • Why this Hibernate JPQL query can&#39;t work?
    via by Unknown author,
  • 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.
    via by david zhang,
    • java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based! ... at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:397) at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:369)
    No Bugmate found.