0

在 java 中,通过查询获取实体有时会在极少数情况下返回较少的实体。我正在使用 javapersistance 管理器。使用它是理想的还是需要切换到低级数据存储获取来解决它?

String query = "CUID == '" + cuidKey + "' && staffKey == '" + staffKey +"'&& StartTimeLong >= "+ startDate + " && StartTimeLong < " + endDate + " && status == 'confirmed'";

List<ResultJDO> tempResultList = jdoUtils.fetchEntitiesByQueryWithRangeOrder(ResultJDO.class, query, null, null, "StartTimeLong desc");

结果在极少数情况下返回 4 个实体,但大多数时候返回所有 5 个实体。

jdoUtils 是一个 PersistanceManager 对象。我是否需要切换到低级数据存储获取准确的结果。

4

1 回答 1

0

I have tried researching about the library you mentioned and for similar issues and found nothing that far. It's hard to know why this is happening or how to fix it with as little information.

On the other hand, the recommended way of programmatically interact with Google Cloud Platform products is through Google's client libraries since they are already tested and assured to work in almost all cases. Furthermore, their usage allows to open Github issue's if you find any problem so that the developers could address them. For the rare cases that you need some functionality not already covered you can open a feature request or directly call the API's.

In addition to Google's libraries there are two other options for Java that are under active development. One is Objectify and the other is Catatumbo.

I would suggest switching to Java Datastore libraries. You could find examples on how to interact with Datastore in link1 and link2. Also you could find community shared code samples in this programcreek page.

于 2020-02-14T10:49:52.603 回答