Realm Java 0.72

We just released a Realm Java update to this website and to Maven. It includes support for Eclipse, Link Queries, Sorting on more field types, Transaction Rollback and more!

Eclipse Support

This was the most commonly asked question and we streamlined the process. The distribution file now includes an “eclipse” folder. Its contents need to be copy-pasted into the libs folder of the Eclipse project and the annotation processor needs to be enabled. For more informations on how to do it please refer to the documentation.

It is now possible to create queries that will traverse links and link lists. The syntax looks like:

RealmResults<Person> owners = realm.where(Person.class)
                                   .equalTo("dogs.name", "Rex")
                                   .findAll();

This will find all people who have at least one dog named “Rex”. For more informations and examples please refer to our documentation.

Improved Sorting

It is now possible to sort on the following field types: boolean, byte, short, int, long, float, double, Date, and String.

Transaction Canceling

This allows to avoid committing a transaction in case an error occurs. Like this:

Dog dog = realm.where(Dog.class).equalTo("name", "Rex").findFirst();
try {
    realm.beginTransaction();
    String dogName = getDogName(); // This might throw
    dog.setName(dogName);
    realm.commitTransaction();
} catch(SomeException e) {
    realm.cancelTransaction();
}

A common use case for transaction canceling are forms. You can now more easily manage the creation of objects where properties come from user operated forms. Again, for more informations and examples please refer to the documentation.

Feedback

As usual your feedback is very important to us! Keep it coming and help Realm get better and better with each release! Please let us know what you need on GitHub or realm-java.