I'm trying to write an HQL query which will calculate an average rating for an item. I want the query to return 0 instead of null when there are no rating for a given item - so that I can use my query as a subquery. So is it possible? Is there an HQL equivalent of IFNULL or NVL?
相关问题
- How does the JPA handle partial, non-disjoint inhe
- Tell hibernate hbm2ddl not create individual table
- Should there be an EntityManager per thread in Spr
- Hibernate and multiThread Logic
- Why does Hibernate perform a JNDI lookup?
相关文章
- Hibernate Tutorial - Where to put Mapping File?
- Hibernate doesn't generate cascade
- Fluent NHibernate — Saving Entity with Composite K
- Setup and Tear Down of Complex Database State With
- Is this the right way of using ThenFetch() to load
- Can Persistence Ignorance Scale?
- How to left join unrelated entities?
- How to map an abstract collection with jpa?
COALESCE is the official equivalent.
It returns the first non-null of its arguments.
Example:
Link Wikipedia
Nhibernate docs are out of date. Check http://docs.jboss.org/hibernate/stable/core/reference/en/html/queryhql.html
If nothing works you can try: