Scooter Runs Faster!

Introducing Scooter 1.2 Release

With Scooter Framework 1.2 release, Scooter runs much much faster and much easier to use. The following is a highlight of some important features in this release. For a full list of features and updates, click Release Note.

Much improved performance

Release 1.2 simplifies lots of code and also add request thread cache and second-level cache.

Request thread cache is turned on by default. It caches retrieved objects in the same thread so that subsequent invocation of the same retrieval will not hit database.

To turn on request thread cache is very easy. Just add the following property in file.


Second-level cache is not turned on by default. When it is turned on, it caches results beyond the life scope of a request.

To turn on second-level cache is very easy. Just add the following property in file.



There are other second-level cache plugins available besides EhCache. You can also set cache clear policy. Cache can be set at method level. See more details in Caching

The following table shows how much has been improved with this release. All numbers are milliseconds per 10000 select statement execution.

                         AR     AR (trans)  JDBC
1.1                     11730     7237      2179
1.2 no cache             7543     2586      2311
1.2 thread cache          196      142
1.2 2nd level cache        92       90

AR stands for ActiveRecord based query. AR (trans) stands for transaction-enabled ActiveRecord query. JDBC stands for query with JDBC.

Clearly, release 1.2 improves performance even when no cache is used. When retrieval requests in the same request thread are grouped by a transaction, it helps performance. However, the ultimate performance boost comes from adding cache in the application. The second-level cache greatly improves the performance.

Easier to create scaffold code for any tables

With Release 1.1, when you create a scaffold code for a table in database, you are required to use either the same name or the singular form of the table name as a model name. With Release 1.2, you can use any model name with -Dtable=YourTableName propery.

For example, if your table name is messages, you can create a post model scaffold application for the table with this:

>java -Dtable=messages -jar tools/generate.jar blog scaffold post

Better enhancement support

With Release 1.1, Scooter's embedded compiler often competes with IDE (such as Eclipse) compiler. This sometimes causes Scooter code enhancement not successful. Now in Release 1.2, you can run an Ant task app_enhancer to force the enhancement when running environment is DEVELOPMENT.

>ant -DappPath=webapps/blog app_enhancer

Better pagination support

A few more overloaded static methods of jdbcPaginator are added to ActionControl class. Now you can easily add pagination control through the new overloaded methods. For example, you can specify your own value of limit:

public String index() {
    Paginator page = jdbcPaginator(Post.class, "limit=50");
    setViewData("post_page", page);
    return renderView("paged_list");

And if this is not good enough, you can always use the Paginator class itself:

public String index() {
    int npage = Util.getSafeIntValue(p("npage"));
    if (npage == 0) {
        npage = 1;
    Paginator page = Post.limit(50).page(npage).getPaginator();
    setViewData("post_page", page);
    return renderView("paged_list");