JDBC design pattern with anonymous class