-->
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: Not able to use two selects in HQL
PostPosted: Tue Oct 21, 2014 5:11 am 
Newbie

Joined: Tue Oct 21, 2014 5:07 am
Posts: 1
Using Hibernate and its query Language. I try to execute the below query in POJO

String sql = "select (select count(*) from Data v where "
+ insuranceId
+" in (v.insuranceId1.id, v.insuranceId2.id, v.insuranceId3.id))"
+" + (select count(*) from Sat s where "
+ insuranceId
+" in (s.insuranceId1.id, s.insuranceId2.id, s.insuranceId3.id))";




Using Hibernate and its query Language. I try to execute the below query in POJO

String sql = "select (select count(*) from Data v where "
+ insuranceId
+" in (v.insuranceId1.id, v.insuranceId2.id, v.insuranceId3.id))"
+" + (select count(*) from Sat s where "
+ insuranceId
+" in (s.insuranceId1.id, s.insuranceId2.id, s.insuranceId3.id))";

em.createQuery(sql, Long.class).getSingleResult();

I get the following error

2:27:47,128 ERROR [stderr] (http-/0.0.0.0:8080-5) java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select (select count(*) from Data v where 991 in (v.insuranceId1.id, v.insuranceId2.id, v.insuranceId3.id)) + (select count(*) from Slot s where 991 in (s.insuranceId1.id, s.insuranceId2.id, s.insuranceId3.id))]


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.