ObjectBox 2.0 will be a big step ahead and we are proud to announce the beta release today. Relations and queries are the two major themes. First, ObjectBox finally allows queries to use relations to expand queries across multiple entities. We call this “link” and it is simpler to use than a SQL “join” as used in conventional databases:
1 2 3 |
QueryBuilder<Person> query = box.query().equal(Person_.firstName, "Kermit"); query.link(Person_.address).equal(Address_.street, "Sesame Street"); List<Person> kermitsOnSesameStreet = query.build().find(); |
Another important step are bi-directional many-to-many relations. Now, ObjectBox is “relation complete” with unidirectional to-one and to-many relations, which can be extended into bi-directional one-to-many and many-to-many. To define the latter, you simply add a @Backlink annotation to a List member, pointing in the reverse direction of the primary relation:
1 2 3 4 5 6 7 8 |
public class Student { List<Teacher> teachers; } public class Teacher { @Backlink // results in many-to-many List<Student> students; } |
ObjectBox 2.0 beta comes with additional features like support for Android’s Paging library. Check the changelog for details.
Let us know what you think of the new APIs and what we can improve before we finalize version 2 in the next weeks. And because we know that many of you asked for unique constraints, we will add those to the final 2.0 as well
***
ObjectBox is a super fast database and synchronization solution, built uniquely for Mobile and IoT devices. We bring edge computing to small devices, allowing data to be stored and processed from sensor to server for reliable, fast and secure data management. ObjectBox is smaller than 1MB, so it is the ideal solution across hardware from Mobile Apps, to IoT Devices and IoT Gateways. We are the first high-performance NoSQL, ACID-compliant on-device edge database. All of our products are built with developers in mind, so they are easy to use and take minimal code to implement.