-->
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.  [ 2 posts ] 
Author Message
 Post subject: problem with complicated query
PostPosted: Tue Jun 28, 2005 1:07 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 1:45 pm
Posts: 38
I need to execute a complicated query as below --

select a.covno, a.covdesc, b.limitsno from Coverage a, Policycoverage b where policyno = :policyno and customerno = :customerno and a.covno = b.coverage.covno union select covno, covdesc, null from Coverage where covno not in (select c.covno from Coverage c, Policycoverage d where c.covno = d.coverage.covno and d.policyinfo.policyno = :policyno and d.customerno = :customerno)


this is the pseudo code --

Query qry = session.createSQLQuery(qryString); //qryString is the above sql

qry.setParameter("policyno", new Integer(1));
qry.setParameter("customerno", new Integer(1));
List list = qry.list();

This code throws an exception "addEntity() or addScalar() must be called"

I need to get the results back in List of HashMap fashion. How do I fix the query/code to 1)avoid the error and 2)get List of HashMap back which represents the ResultSet

Please help!!

- Nilesh


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 03, 2005 12:06 pm 
Newbie

Joined: Wed Aug 03, 2005 11:56 am
Posts: 7
Nilesh,

You can create "VIEW" for your complex query and use it as entity.

Thanks,
Sanjay


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.