We’re happy to announce 1.4 of our superfast mobile database that comes with three new features:

Queries may now return values for an individual property (also supports distinct values)

Entities may extend other entities

50% size reduction of native library

Property queries were one of the most requested features in the last months. They do not to return entire objects but only one property of the entity. This can be much more efficient and convenient. For example, you may only need the email adresses of all users entity:

String[] emails = userBox.query().build().property(User_.email).findStrings(); 1 String [ ] emails = userBox . query ( ) . build ( ) . property ( User_ . email ) . findStrings ( ) ;

An important aspect of querying individual properties are distinct values. For example, let’s query all the different (distinct) first names users have (“Joe” will be returned only once regardless of how many users are named “Joe”):

String[] names = userBox.query().build().property(User_.firstName).distinct().findStrings(); 1 String [ ] names = userBox . query ( ) . build ( ) . property ( User_ . firstName ) . distinct ( ) . findStrings ( ) ;

The API also let’s you configure the behavior in regards to null values and string case sensitivity. Check the JavaDocs of PropertyQuery for details.

Entity inheritance is the other new major functionality. You can now define persistent properties in super classes annotated with @Entity or the new @BaseEntity. The following example illustrates how to define a base class for all shapes including properties for a bounding box:

@BaseEntity public class Shape { @Id long id; public double boundingBoxX1, boundingBoxY1, boundingBoxX2, boundingBoxY2; } @Entity public class Circle extends Shape { public double x, y, radius; } @Entity public class Triangle extends Shape { public double x1, y1, x2, y2, x3, y3; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 @BaseEntity public class Shape { @Id long id ; public double boundingBoxX1 , boundingBoxY1 , boundingBoxX2 , boundingBoxY2 ; } @Entity public class Circle extends Shape { public double x , y , radius ; } @Entity public class Triangle extends Shape { public double x1 , y1 , x2 , y2 , x3 , y3 ; }

For more details and current restrictions, please check the entity inheritance docs.

And last but not least, we halfed the size of ObjectBox native libraries! The size of the AAR went down from 2,523 KB in V1.3.4 to 1,553 KB (38% reduction of the compressed archive containing 4 ABIs). We’re very happy about this, because we are dedicated to keep ObjectBox as fast and lean as possible.