问题
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