HQL 中的 IsNull 是什么?
What is IsNull in HQL?
如何编写这样的 HQL 查询 SQL 查询?
SELECT IsNull(name, '') FROM users
当我搜索 HQL IsNull 时,所有结果都是 IS NULL 或 IS NOT NULL
如果您检查 Hibernate documentation you can see that they provide many useful expressions for such statements, you can check the CASE expressions section where it says that you can use coalesce()
表达式而不是 ISNull()
.
因此您的查询将是:
SELECT coalesce(name, '') FROM users
您可以查看他们的 Simple case expression example 了解更多详情。
如何编写这样的 HQL 查询 SQL 查询?
SELECT IsNull(name, '') FROM users
当我搜索 HQL IsNull 时,所有结果都是 IS NULL 或 IS NOT NULL
如果您检查 Hibernate documentation you can see that they provide many useful expressions for such statements, you can check the CASE expressions section where it says that you can use coalesce()
表达式而不是 ISNull()
.
因此您的查询将是:
SELECT coalesce(name, '') FROM users
您可以查看他们的 Simple case expression example 了解更多详情。