Large results processing in Mirage

The next release of Mirage is 1.0.3. It contains some new features. Today, I write about iteration search which is one of them.

SqlManager#getResultList() creates all entity instances and returns a list which contains them. If SQL returns a large result, it causes OutOfMemory.

In these case, you should use SqlManager#iterate() instead of SqlManager#getResultList().

Integer result = sqlManager.iterate(
  new IterationCallback<Book, Integer>() {

    private int result;

    @Override public Integer iterate(Book entity) {
      result = result + entity.price;
      return result;

  SQL_PREFIX + "SqlManagerImplTest_selectBooks.sql");

SqlManager#iterate() accepts IterationCallback and invoke it per record. The return value of SqlManager#iterate() is a last returned value from IterationCallback.

Iteration search would be available in Mirage 1.0.3.


Mirage 1.0.2 Released!

Mirage 1.0.2 is now available!

Mirage is a simple SQL centric database access library. See the following URL to know about Mirage:

1.0.2 is a maintenance release. Here is the list of changes in this release:

  • Dependency to Spring Framework and Guice became optional.
  • Dependency to the pached OGNL changed to OGNL 2.7.3.
  • BugFix about BLOB support.

BLOB support in 1.0.1 does not work because it contains a serious bug. This bug was fixed in 1.0.2 and dependencies was reviewed and modified to minimum.

And also Mirage with Apache Click example is released. You can get it from the download page.

I wish that Mirage helps your development. Enjoy!


Mirage and Apache Click Example

I started to make a sample application to use Mirage with Apache Click.

This sample application has not been completed yet. However you can checkout source code from the following URL using Subversion.

You can build a war file using Maven. Please execute following commands in command prompt.

$ svn co http://svn.sourceforge.jp/svnroot/amateras/mirage/trunk/mirage-click-example/
$ cd mirage-click-example
$ mvn package

Then you can find mirage-click-example.war in the /target directory.

Put it into the application server such as Tomcat and access http://localhost:8080/mirage-click-example/ using your browser.

Mirage 1.0.1 Released!

Mirage is a simple SQL centric database access library. Today, I've just released Mirage 1.0.1. It's already available.

See the following URL to know about Mirage:

Here is the list of new features in this release:

  • Use java.util.logging instead of slf4j / logback to remove them from dependency.
  • Simple example and documentation for Google Guice integration.
  • It's possible to specify a transient property by transient modifier instead of @Transient annotation.
  • Add new method SqlManager#findEntity(Class clazz, Object... id)
  • Add new method SqlManager#getCount(String sqlPath[, Object param])
  • ValueType interface to add custome value type support
  • BLOB support

Mirage is still not enough to use in complex systems. So we would improve it as much as possible soon.