realm-java

Realm java nested query on same ArrayObject

假如想象 提交于 2019-12-25 01:49:12
问题 Current code: mRealm.where(AdditionalData.class) .contains("checklistParticipants.email", a@a.com, Case.INSENSITIVE) .equalTo("checklistParticipants.type", 0) .findAll(); which returns me result of similar to ANY record. I want to check in nested query, only return record if and if both condition fulfilled. likewise in nested query, record email must be a@a.com and type=0 i tried below approach but ended up in same result. mRealm.where(AdditionalData.class) .contains("checklistParticipants

Realm insertion of JSON object takes 60ms per object

谁都会走 提交于 2019-12-24 19:41:42
问题 I have the following json object : https://pastebin.com/B9Z1Wmqd Currently using Realm 2.0.2 My relevant objects (simplified) are as follows so you can see the mapping : Top level object: public class PlannedTaskDao extends RealmObject { @PrimaryKey private Long tasks_id; private Date date; private Date lastUpdate; private Long clients_id; private String hour; private String libelle; private String comments; private Boolean closed; private int displayOrder; private long executionTime; private

Update specific realm model properties?

亡梦爱人 提交于 2019-12-23 21:59:45
问题 How to update only some realm model properties and instead of trying to save complete realm model again and again using copyToRealmOrUpdate() . public class User extends RealmObject { @PrimaryKey public String id = UUID.randomUUID().toString(); private String name; private int age; @Ignore private int sessionId; // Standard getters & setters generated by your IDE… public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age;

Android Studio 3.0 error: android-apt is incompatible

為{幸葍}努か 提交于 2019-12-13 13:13:43
问题 I'm new to Android development and got a legacy project. So I installed the newest version of Android Studio and opened it. When I try to build it, I get this error: Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead. I've trying the solutions shown in these thread, but it did not work. I don't have any android-apt reference on my grandle build script. Many of compile packages are shown as outdated. But when I follow

Realm, complex linked query

徘徊边缘 提交于 2019-12-13 03:37:40
问题 in the official docs, https://realm.io/docs/java/latest/#link-queries - there's an example how to select owners of "Brown Fluffy" dogs. My questions is, how do I select only those not having Brown Fluffy (and, obviously, those having no dogs at all) I do not see how can one achieve this result by, say, using .not().beginGroup().equalTo(...).equalTo(...).endGroup() (that someone with previous SQL experience would try) Thanks a lot in advance! 回答1: Have you tried .not().equalTo(...).findAll()

MapStruct - mapping RealmList relationship

帅比萌擦擦* 提交于 2019-12-12 05:28:43
问题 Okay, I'm not very sure how to ask this but I'm going to try. I am using MapStruct to map my incoming network objects to database objects. I use Realm.io as my local datastore. Some of my objects have RealmList<Obj> which store their relationships, for example: public class Client extends RealmObject { @PrimaryKey private String id = UUID.randomUUID().toString(); private Date createdAt = new Date(); private Date updatedAt = new Date(); private RealmList<Contact> contacts; // <-- this guy //

RealmChangeListener does not execute when added shortly after asynchronous write

两盒软妹~` 提交于 2019-12-12 01:26:14
问题 Long story short: I do not know why my RealmChangeListener does not trigger as intended under certain circumstances and am looking for advice on why a RealmChangeListener could not be working. Update: I have verified that the RealmResults stay valid = true; loaded=false. If I execute RealmResults.load() after adding the change listener, it will output a vague Throwing Exception 7 in the log and a BadVersionException when I step through the Realm source. I think this exception makes some sense

Realm database decryption failed

老子叫甜甜 提交于 2019-12-04 06:14:37
问题 Question : When I try to open encrypted realm file in Realm Browser (windows) and it gives me following message. Either this is not a Realm file or it's encrypted. Enter: 128-character hex-encoded encryption key Important - I am closing my realm before saving on disk. Code RealmConfiguration config = new RealmConfiguration.Builder() .name("w5uyqFyEDEK_OCWyl4123aa77") .schemaVersion(2) .encryptionKey(myClassObject.getRealmKey()) .deleteRealmIfMigrationNeeded() .build(); Methods public byte[]

Realm database decryption failed

白昼怎懂夜的黑 提交于 2019-12-02 10:08:55
Question : When I try to open encrypted realm file in Realm Browser (windows) and it gives me following message. Either this is not a Realm file or it's encrypted. Enter: 128-character hex-encoded encryption key Important - I am closing my realm before saving on disk. Code RealmConfiguration config = new RealmConfiguration.Builder() .name("w5uyqFyEDEK_OCWyl4123aa77") .schemaVersion(2) .encryptionKey(myClassObject.getRealmKey()) .deleteRealmIfMigrationNeeded() .build(); Methods public byte[] getRealmKey() { byte[] key; String savedKey = getStringFromPrefs(KEY); if (savedKey.isEmpty()) { key =

Realm String greaterThan

佐手、 提交于 2019-12-01 10:30:40
Is there any way to find all (or just the next) RealmObject s with Strings lexicographically greater than the target? Something like MyEntry next = realm.where(MyEntry.class) .greaterThan("name", current) .findAllSorted("name") .first(); which did not work, because greaterThan is not implemented for String s. As a non-db-workaround, you can use List<MyEntry> l = realm.where(MyEntry.class) .findAllSorted("name"); int pos = l.indexOf(entryWithName); MyEntry next = l.get((pos+1)%l.size()); This does the searching outside of the db. Possibly not as well-performing, and not as readable, but it