2011-03-10

Problems with "org.hibernate.QueryException: unindexed collection before..."?

Hi again.

Lately, I have been struggling with the above issue when doing JPAQL query with Hibernate application on WebLogic 10.0.3 (Oracle 11g) server.

My setup to make the application work on WebLogic was:


  1. Remove all javax.* jars from WEB-INF/lib, including xml-api.jar and xerces

  2. Add weblogic.xml to WEB-INF with prefer-web-inf-classes set to true

  3. Set the hibernate property hibernate.query.factory_class to org.hibernate.hql.classic.ClassicQueryTranslatorFactory to avoid antlr class conflicts



Everything worked fine until I started to create som rather complex queries involving collections. Then I ended ut with "org.hibernate.QueryException: unindexed collection before..." exceptions.

The way I solved it was to replace the prefer-web-inf-classes setting in weblogic.xml with:

<prefer-application-packages>
  <package-name>antlr.*</package-name>
<prefer-application-packages>

and removing the hibernate property to use the ClassicQueryTranslatorFactory.

Then everything worked like a charm.

Hope this can help you resolve this issue :)