O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

StorIO database query

However, what goes inside the .onExceptionResumeNext(...) call? Basically, we need to query the database using StorIO. The query is created by calling the following:

StorIOFactory.get(this)        .get()        .listOfObjects(StockUpdate.class)        .withQuery(Query.builder()                .table(StockUpdateTable.TABLE)                .orderBy("date DESC")                .limit(50)                .build())        .prepare()

Let's go line by line to see what this code does. The following line, which is the first line, instructs StorIO to start building a SELECT query:

.get()

The following line specifies what kind of type objects will be returned:

.listOfObjects(StockUpdate.class)

This call is basically used to select the appropriate mapper (GetResolver) to do a mapping from the SELECT query columns ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required