Realm - Querying long-type class returns empty

只愿长相守 提交于 2019-12-11 08:46:18

问题


When querying equalTo a field with long type, the RealmResults returns blank. My query code is as below:

_realm.beginTransaction();
long albumID = Long.valueOf(albumId);
results = _realm.where(Image.class).equalTo("albumId",albumID).findAll();
_realm.commitTransaction();

albumId is a string passed by a method

Image class:

public class Image extends RealmObject {
  @PrimaryKey
  private long id;
  private long albumId;
  private String url;
  private int width;
  private int height;
  private long published;

//Setters and getters
}

I tried to query without the equalTo and see that the results contain albumId values

来源:https://stackoverflow.com/questions/30138203/realm-querying-long-type-class-returns-empty

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!