The Avajé Ebean Framework and asynchronous query execution

Yesterday, I posted about the Ollin Framework, which implements fetching data into callback types, similar to Spring’s JdbcTemplate. Another idea I had recently discovered, is that of asynchronous query execution. Even if there are only few use cases for that in every day development life, sometimes it’s interesting to be able to load data in the background. An example is an accounting application that displays a pre-calculated dashboard with interesting information for the user to keep them busy and distracted, while the heavy load of accounting data is loaded in the background for the more sophisticated screens. Or maybe you just want to take advantage of your high-performant Oracle database and run several OLAP queries in parallel while you generate a neat report for your user.

This idea is implemented in the Avajé EBean Framework, which makes use of the java.util.concurrent.Future API. The example they provide looks like this:

Query<Order> query = Ebean.find(Order.class);
FutureList<Order> futureList = query.findFutureList();

// do something else ...

if (!futureList.isDone()) {

// wait for the query to finish...
List<Order> list = futureList.get();

This really looks appealing, I think! In the jOOQ world, this would map to something like this

FutureResult<BookRecord> result =
      .where( /* expensive subquery */ ))

… and the rest is pretty much the same, as FutureResult just extends both org.jooq.Result and java.util.concurrent.Future.

One thought on “The Avajé Ebean Framework and asynchronous query execution

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.