如何在 postgres 和 Hibernate/Spring 中使用 LIMIT 子句

问题描述

我有这个在我的 DAO 中不起作用的本机查询

@Query(
            nativeQuery = true,value = "DELETE FROM products_in_carts WHERE cart_id =?1 AND product_name = ?2 LIMIT= 1"
    )
    void removeProduct(long id,String productName);

返回:org.postgresql.util.PSQLException: ERROR: syntax error at or near "LIMIT"

我按照其他一些问题的建议尝试使用 OFFSET,但也不起作用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)