You have to use the “new map” syntax (Hibernate Reference paragraph 14.6)
select new map(count(i.inspectionId) as tot_inspections, t.year as year, t.quarter as quarter) from ...
The rest of the query is the same. This will return a list of maps, where the key is the alias of the “column”.
More Related Contents:
- Getting a ‘No thread-bound request found’ error from spring in my web app
- How do you do a limit query in JPQL or HQL?
- Hibernate: different object with the same identifier value was already associated with the session [duplicate]
- Hibernate Criteria returns children multiple times with FetchType.EAGER
- Why does Hibernate require no argument constructor?
- How can I log SQL statements in Spring Boot?
- How to choose the id generation strategy when using JPA and Hibernate
- JPQL Create new Object In Select Statement – avoid or embrace?
- Hibernate, @SequenceGenerator and allocationSize
- What is the difference between Unidirectional and Bidirectional JPA and Hibernate associations?
- What’s the difference between session.persist() and session.save() in Hibernate?
- Why do I need Transaction in Hibernate for read-only operations?
- What is the easiest way to ignore a JPA field during persistence?
- @Transactional method called from another method doesn’t obtain a transaction
- Spring 3 MVC: one-to-many within a dynamic form (add/remove on create/update)
- Hibernate bidirectional @ManyToOne, updating the not owning side not working
- Spring boot JPA insert in TABLE with uppercase name with Hibernate
- How to get distinct results in hibernate with joins and row-based limiting (paging)?
- When are connections returned to the connection pool with Spring JPA (Hibernate) Entity Manager?
- Hibernate, Postgres & Array Type
- Light weight alternative to Hibernate? [closed]
- Java: Hibernate @OneToOne mapping
- Hibernate, spring, JPS & isolation – custom isolation not supported
- Hibernate, Java 9 and SystemException
- Hibernate vs JPA vs JDO – pros and cons of each? [closed]
- Why has javax.persistence-api been replaced by jakarta.persistence-api in spring data jpa starter?
- Spring Data JPA: How can Query return Non- Entities Objects or List of Objects?
- java.lang.IllegalStateException: No transactional EntityManager available
- How to write a like query in HQL
- Hibernate Criteria API: get n random rows