-->
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.  [ 1 post ] 
Author Message
 Post subject: Question related HQL involving Parent and child objects
PostPosted: Mon Aug 23, 2004 2:22 am 
Newbie

Joined: Wed Jun 30, 2004 4:50 am
Posts: 12
2.1.4:

I wrote a HQL to select an entity and its relations in HQL expecting to get a single object array with entity and collections of childs as its elements.

I know that its not necessary to select relations as Hibernate will fetch for me when required but in our case this fetch happens out of session scope(becuase we use session per operation, so no scope for lazy loading, no proxies, and lots of nos.. etc etc thats pathetic persistance architecture we had which is not in my control and no suggestions are acceptable here and there is no reason why session scope should not be at servlet filter or struts controller?!)

So please tell me whether its possible to get entity and one-many relationship data with a single HQL or I need to fire another HQL for getting relationship data.

Below is the exception I get when I execute above mentioned scenario.

net.sf.hibernate.QueryException: expecting 'elements' or 'indices' after: id [SELECT ro, ro.gvehma, cust, ro.saojobs FROM com.xxx.my.bms.valueobject.SaoRo ro, com.xxx.my.bms.valueobject.Gcust cust WHERE ro.custId = cust.c1cuid AND ro.status > '30' AND ro.roNo IS NOT NULL AND ro.roNo = ?]
at net.sf.hibernate.collection.CollectionPropertyMapping.toType(CollectionPropertyMapping.java:53)
at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:249)
at net.sf.hibernate.hql.PathExpressionParser.end(PathExpressionParser.java:288)
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:1554)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1525)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)


Thank you very much..

Regards,
Surya.


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

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.