-1
session.createSQLQuery("SELECT EXISTS
(SELECT 1 FROM master.invoices WHERE currency_id = 17879)").list()
給了我BigInteger。 如何獲得布爾值?Hibernate createSQLQuery。如何獲得布爾值
session.createSQLQuery("SELECT EXISTS
(SELECT 1 FROM master.invoices WHERE currency_id = 17879)").list()
給了我BigInteger。 如何獲得布爾值?Hibernate createSQLQuery。如何獲得布爾值
這裏是如何工作的。
Boolean.valueOf((List<String>) session.createSQLQuery("SELECT IF
(SELECT 1 FROM master.invoices WHERE currency_id = 17879)
, 'true', 'false')").list());
嘗試此相應老兄
SELECT CASE WHEN EXISTS(
SELECT *
FROM
master.invoices
WHERE currency_id = 17879
)
THEN CAST(1 AS BIT)
ELSE CAST(0 AS BIT) END