• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting count of HQL query

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
found solution by using createAlias
 
Author
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hurric hurric" please check your private messages.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic