Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting count of HQL query

 
Jj Dire
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to do pagination so I need to know the count but it seems such a difficult task to find the count of a query which deferences another table. The query is



Patient POJO is


Here's my attempt at finding the count of this but no matter what it doesn't like the patient_insurance dereferning. I tried select count(*) way and this way and neither seems to work



I am totally lost and wondering what's an easy way just to get a count of a relatively simple query.

When doing select count(*) of the above query I get the "the owner fetched association was not present in the select list" error.

Thanks in advance.
 
Jj Dire
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
found solution by using createAlias
 
Javid Jamae
Author
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to do this with a "select count" query. What are you trying to get a count of exactly? Show the select query and the table structure (DDL).
 
Jj Dire
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the query is shown in my original post. If I just add select count(*) to the first query shown above, hibernate will complain. I've managed to do them all using projections.
every member is a string except date and id (date and integer).
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hurric hurric" please check your private messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic