Sometimes something blindingly obvious strikes me

A while back I made EoD SQL Query objects pool friendly if you construct them with a DataSource (which is the preferred way of doing things). This has a very interesting side effect, since now instead of:

...
UserQuery myQuery = QueryTool.createQueryImplementation(UserQuery.class);
User myUser = myQuery.getUser();
myQuery.close();
...

You can do something really cool:

public interface UserQuery extends BaseQuery {
    public static UserQuery QUERY = QueryTool.getQuery(UserQuery.class);
    ...
}

Since the Query automatically closes any Connection when it’s finished being used, and they are totally thread safe, this is a much much better way of doing things. The “getQuery” method was added this morning as a shorthand for “createQueryImplementation”. In other news, there is a new version of the software.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: