将SQL转换为HQL

问题描述 投票:2回答:2

我有一个有效的SQL查询。

但我无法将其转换为HQL

SELECT * FROM Customer e where RIGHT(e.mobile,10)='999999999';

如何将其写入HQL?

sql spring-data-jpa hql
2个回答
1
投票

RIGHT(str, len)SUBSTRING(str, LENGTH(str) - len + 1)是一回事


1
投票

HQL支持LIKE,因此您可以将其表达为:

SELECT *
FROM Customer e
WHERE e.mobile LIKE '%999999999';
© www.soinside.com 2019 - 2024. All rights reserved.