Spring Data JPA FindAll返回不正确的值

时间:2017-11-10 17:59:42

标签: spring spring-boot spring-data-jpa jpql informix

我编写了连接Informix DB并获取值的代码。我能够连接数据库并获取特定的表值。但是如果我在DB中手动插入一些值并尝试从代码中获取值,我在findAll()响应中没有得到正确的值。

Ex: 
Table Name: XXX_XXX
ser dt           crnt_ts    ser_status
1   2017-11-07  18:15:29    UP
2   2017-11-07  18:15:29    UP
3   2017-11-07  18:15:29    UP
4   2017-11-07  18:15:29    UP
5   2017-11-07  18:15:29    DOWN

现在我从findALL()方法得到了正确的回复。 插入的服务器6具有UP状态和不同的时间戳。

*Table Name: XXX_XXX
ser     dt              crnt_ts     ser_status
1       2017-11-07      18:15:29        UP
2       2017-11-07      18:15:29        UP
3       2017-11-07      18:15:29        UP
4       2017-11-07      18:15:29        UP
5       2017-11-07      18:15:29        DOWN
6       2017-11-08      18:45:29        UP*

如果我尝试使用findALL()获取值,我会收到以下回复。如果您看到与DB不匹配的最后一个值。我该如何解决这个问题?

[
    {
        "Server": "1",
        "dt": "2017-11-07",
        "crntTs": "18:15:29",
        "serStatus": "UP"
    },
    {
        "Server": "2",
        "dt": "2017-11-07",
        "crntTs": "18:15:29",
        "serStatus": "UP"
    },
    {
        "Server": "3",
        "dt": "2017-11-07",
        "crntTs": "18:15:29",
        "serStatus": "UP"
    },
    {
        "Server": "4",
        "dt": "2017-11-07",
        "crntTs": "18:15:29",
        "serStatus": "UP"
    },
    {
        "Server": "5",
        "dt": "2017-11-07",
        "crntTs": "18:15:29",
        "serStatus": "DOWN"
    },
    {
        "Server": "6",
        "dt": "2017-11-07",
        "crntTs": "18:15:29",
        "serStatus": "DOWN"
    }]

0 个答案:

没有答案