【问题标题】:org.springframework.data.jpa.repository.Query Params wrong resultorg.springframework.data.jpa.repository.Query Params 错误结果
【发布时间】:2022-01-19 11:09:31
【问题描述】:

您好,我对这种方法的结果有疑问:

@Query(value = "select * from Mail where sent_Flag = 0 and scheduled < '?1'", nativeQuery = true)
    public List<Mail> getToSend(Long timestamp);

如果我输入值 0 或当前时间戳结果相同(返回所有记录,如预定 1=1),如果我尝试通过 SQL 直接运行它,一切正常,问题出在哪里?

我正在使用 SQLite 和 springboot

【问题讨论】:

    标签: spring-boot sqlite jpa


    【解决方案1】:

    不知道为什么,但适用于“

    select * from Mail where sent_Flag = 0 and scheduled between 0 and ?
    

    【讨论】:

    • 之所以有效,是因为您在第一个解决方案中使用了' 周围的?
    猜你喜欢
    • 2022-10-21
    • 2014-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-16
    相关资源
    最近更新 更多