-->
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.  [ 4 posts ] 
Author Message
 Post subject: unindexed collection before []: please help
PostPosted: Fri Sep 24, 2004 11:11 am 
Newbie

Joined: Tue Jun 22, 2004 11:35 am
Posts: 10
when i try to access a set containing child objects i get an error, i'm probably doing something stupid can anyone help. using the hql SELECT lic.licNo, lic.customer.ref,
lic.customer.custContacts FROM Licence lic WHERE lic.licNo IN (:licNo0_, :licNo1_, :licNo2_)

Hibernate version:
2.1

Hibernate mapping:


<class
name="package.Licence"
table="LICENCES"
>
<cache usage="read-write" />
<id column="LIC_NO" name="licNo" type="int">
<generator class="assigned"/>
</id>

<many-to-one
name="customer"
class="package.Customer"
cascade="none"
not-null="true"
insert="true"
update="true"
>
<column name="CUS_REF" />
</many-to-one>

<many-to-one
name="licenceProduct"
class="package.LicenceProduct"
not-null="true"
insert="true"
update="true"
cascade="none"
>
<column name="SEC_CODE" />
<column name="LCL_CODE" />
<column name="LPR_NO" />
</many-to-one>

<many-to-one
name="businessUse"
class="package.BusinessUse"
not-null="false"
cascade="none"
insert="true"
update="true"
>
<column name="BUS_CODE"/>
</many-to-one>
</class>


<class
name="package.Customer"
table="CUSTOMERS"
>
<cache usage="read-write" />
<id
name="ref"
type="java.lang.String"
column="REF"
>
<generator class="assigned" />
</id>
<many-to-one
name="address"
class="uk.org.ofcom.assignment.vo.Address"
cascade="none"
not-null="true"
insert="true"
update="true"
column="ADD_ID" />
<set name="custContacts" inverse="true">
<key column="CUS_REF"/>
<one-to-many class="uk.org.ofcom.assignment.vo.CustContact"/>
</set>
</class>

<class name="uk.org.ofcom.assignment.vo.CustContact" table="CUST_CONTACTS">
<id column="CCN_ID" name="ccnId" type="java.lang.Long">
<generator class="native"/>
</id>
<many-to-one
name="address"
class="uk.org.ofcom.assignment.vo.Address"
cascade="none"
not-null="true"
insert="true"
update="true"
column="ADD_ID" />

<many-to-one
name="customer"
class="uk.org.ofcom.assignment.vo.Customer"
cascade="none"
not-null="true"
insert="true"
update="true" >
<column name="CUS_REF" />
</many-to-one>
<set name="custContactTypes" lazy="true>
<key column="CCN_ID"/>
<one-to-many class="uk.org.ofcom.assignment.vo.CustContactType"/>
</set>
</class>

Code between sessionFactory.openSession() and session.close():

Query lqu = session.createQuery(hsql).setCacheable(true);
Collection list = new ArrayList();
Iterator iter = lqu.iterate();
while (iter.hasNext()) {
list.add(iter.next());
}

Full stack trace of any exception that occurs:
net.sf.hibernate.QueryException: unindexed collection before []: licence0_.customer.custContacts [SELECT lic.licNo, lic.licenceProduct.description, lic.customer.ref, lic.customer.name, lic.customer.custContacts FROM uk.org.ofcom.assignment.vo.Licence lic WHERE lic.licNo IN (:licNo0_, :licNo1_, :licNo2_) ]
at net.sf.hibernate.hql.PathExpressionParser.prepareForIndex(PathExpressionParser.java:303)
at net.sf.hibernate.hql.PathExpressionParser.end(PathExpressionParser.java:287)
at net.sf.hibernate.hql.SelectPathExpressionParser.end(SelectPathExpressionParser.java:14)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:154)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114)
at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:293)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1530)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1560)
at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:27)
at uk.org.ofcom.dao.HibernateDataLoader.getCollectionFromSql(HibernateDataLoader.java:156)
at uk.org.ofcom.rules.AbstractRulesReader.getCollectionFromSql(Unknown Source)
at uk.org.ofcom.rules.CustomerManager.listCustomersByLicNo(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:402)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:309)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:333)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:479)

Name and version of the database you are using:
Oracle 9i

The generated SQL (show_sql=true):
no sql shown

Debug level Hibernate log excerpt:
2004-09-24 15:41:34,698 [HttpRequestHandler-7248746] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
2004-09-24 15:41:34,699 [HttpRequestHandler-7248746] DEBUG net.sf.hibernate.impl.SessionImpl - iterate: SELECT lic.licNo, lic.licenceProduct.description, lic.customer.ref, lic.customer.name, lic.customer.custContacts FROM Licence lic WHERE lic.licNo IN (:licNo0_, :licNo1_, :licNo2_)
2004-09-24 15:41:34,699 [HttpRequestHandler-7248746] DEBUG net.sf.hibernate.engine.QueryParameters - named parameters: {licNo1_=708, licNo2_=123456, licNo0_=2008}
2004-09-24 15:41:34,704 [HttpRequestHandler-7248746] DEBUG net.sf.hibernate.hql.QueryTranslator - compiling query
2004-09-24 15:41:34,727 [HttpRequestHandler-7248746] DEBUG net.sf.hibernate.impl.SessionImpl - closing session
2004-09-24 15:41:35,039 [Finalizer] DEBUG net.sf.hibernate.impl.SessionImpl - running Session.finalize()


Top
 Profile  
 
 Post subject: Fixed
PostPosted: Tue Sep 28, 2004 6:11 am 
Newbie

Joined: Tue Jun 22, 2004 11:35 am
Posts: 10
I've found another way to get the required results


Top
 Profile  
 
 Post subject: How did you do it?
PostPosted: Tue Feb 22, 2005 11:21 am 
Newbie

Joined: Tue May 18, 2004 10:51 am
Posts: 9
Location: Bolivia
I have the same problem... how did you solve it?


Top
 Profile  
 
 Post subject: I had the same problem
PostPosted: Tue May 31, 2005 10:47 am 
Newbie

Joined: Mon Feb 23, 2004 8:30 am
Posts: 13
Location: Istanbul, Turkey
I had the same problem. My code was this:

Code:
        shoppingDao.saveCategory(product.getCategory());


The problem was that product.getCategory() was null.

_________________
Mert Nuhoglu
http://jroller.com/page/mnuhoglu


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

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.