// Path: mardao-core/src/main/java/net/sf/mardao/core/filter/Filter.java
// public class Filter {
//     private final String column;
//     private final FilterOperator operator;
//     private final Object operand;
// 
//     private Filter(String column, FilterOperator operation, Object operand) {
//         this.column = column;
//         this.operator = operation;
//         this.operand = operand;
//     }
// 
//     /** Builds an EqualsFilter */
//     public static Filter equalsFilter(String column, Object operand) {
//       return new Filter(column, FilterOperator.EQUALS, operand);
//     }
// 
//     /** Builds an InFilter */
//     public static Filter inFilter(String column, Object operand) {
//       return new Filter(column, FilterOperator.IN, operand);
//     }
// 
//     public static Filter greaterThan(String column, Object operand) {
//         return new Filter(column, FilterOperator.GREATER_THAN, operand);
//     }
// 
//     public static Filter greaterThanOrEquals(String column, Object operand) {
//         return new Filter(column, FilterOperator.GREATER_THAN_OR_EQUALS, operand);
//     }
// 
//     public static Filter lessThan(String column, Object operand) {
//         return new Filter(column, FilterOperator.LESS_THAN, operand);
//     }
// 
//     public static Filter notEqualsFilter(String column, Object operand) {
//       return new Filter(column, FilterOperator.NOT_EQUALS, operand);
//     }
// 
//     public String toString() {
//         return column + " " + operator + " " + operand;
//     }
// 
//     public String getColumn() {
//         return column;
//     }
// 
//     public FilterOperator getOperator() {
//         return operator;
//     }
// 
//     public Object getOperand() {
//         return operand;
//     }
// 
// }
// 
// Path: mardao-core/src/main/java/net/sf/mardao/core/filter/FilterOperator.java
// public enum FilterOperator {
//   EQUALS,
//   IN,
//   GREATER_THAN,
//   GREATER_THAN_OR_EQUALS,
//   LESS_THAN,
//   NOT_EQUALS
// }


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.sf.mardao.core.*;
import net.sf.mardao.core.filter.Filter;
import net.sf.mardao.core.filter.FilterOperator;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
import javax.persistence.Basic;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.sql.DataSource;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.sql.Connection;
import java.util.*;
import java.util.concurrent.Future;
package net.sf.mardao.dao;



/**
 * Created by sosandstrom on 2015-02-21.
 */
public class JdbcSupplier extends AbstractSupplier<JdbcKey, Object, JdbcWriteValue, Connection> {

    public static final String METHOD_SELECT = "SELECT ";
    public static final String CREATE_SEQUENCE = "CREATE_SEQUENCE";
    public static final String INIT_SEQUENCE = "CREATE_SEQUENCE";

    private final DataSource dataSource;
    private final JdbcTemplate jdbcTemplate;
    private final DataFieldMaxValueIncrementer incrementer;
    protected final JdbcDialect jdbcDialect;

    private static final Map<JdbcDialect, Properties> types = new HashMap<JdbcDialect, Properties>();
    private static final Properties defaultTypes = new Properties();
    private static final ObjectMapper MAPPER = new ObjectMapper();

    public JdbcSupplier(DataSource dataSource, DataFieldMaxValueIncrementer incrementer,
                        JdbcDialect jdbcDialect) {
        this.dataSource = dataSource;
        this.incrementer = incrementer;
        this.jdbcTemplate = new JdbcTemplate(dataSource);
        this.jdbcDialect = jdbcDialect;
    }

    @Override
// Path: mardao-core/src/main/java/net/sf/mardao/core/filter/Filter.java
// public class Filter {
//     private final String column;
//     private final FilterOperator operator;
//     private final Object operand;
// 
//     private Filter(String column, FilterOperator operation, Object operand) {
//         this.column = column;
//         this.operator = operation;
//         this.operand = operand;
//     }
// 
//     /** Builds an EqualsFilter */
//     public static Filter equalsFilter(String column, Object operand) {
//       return new Filter(column, FilterOperator.EQUALS, operand);
//     }
// 
//     /** Builds an InFilter */
//     public static Filter inFilter(String column, Object operand) {
//       return new Filter(column, FilterOperator.IN, operand);
//     }
// 
//     public static Filter greaterThan(String column, Object operand) {
//         return new Filter(column, FilterOperator.GREATER_THAN, operand);
//     }
// 
//     public static Filter greaterThanOrEquals(String column, Object operand) {
//         return new Filter(column, FilterOperator.GREATER_THAN_OR_EQUALS, operand);
//     }
// 
//     public static Filter lessThan(String column, Object operand) {
//         return new Filter(column, FilterOperator.LESS_THAN, operand);
//     }
// 
//     public static Filter notEqualsFilter(String column, Object operand) {
//       return new Filter(column, FilterOperator.NOT_EQUALS, operand);
//     }
// 
//     public String toString() {
//         return column + " " + operator + " " + operand;
//     }
// 
//     public String getColumn() {
//         return column;
//     }
// 
//     public FilterOperator getOperator() {
//         return operator;
//     }
// 
//     public Object getOperand() {
//         return operand;
//     }
// 
// }
// 
// Path: mardao-core/src/main/java/net/sf/mardao/core/filter/FilterOperator.java
// public enum FilterOperator {
//   EQUALS,
//   IN,
//   GREATER_THAN,
//   GREATER_THAN_OR_EQUALS,
//   LESS_THAN,
//   NOT_EQUALS
// }


// Path: mardao-jdbc/src/main/java/net/sf/mardao/dao/JdbcSupplier.java
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.sf.mardao.core.*;
import net.sf.mardao.core.filter.Filter;
import net.sf.mardao.core.filter.FilterOperator;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
import javax.persistence.Basic;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.sql.DataSource;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.sql.Connection;
import java.util.*;
import java.util.concurrent.Future;

package net.sf.mardao.dao;



/**
 * Created by sosandstrom on 2015-02-21.
 */
public class JdbcSupplier extends AbstractSupplier<JdbcKey, Object, JdbcWriteValue, Connection> {

    public static final String METHOD_SELECT = "SELECT ";
    public static final String CREATE_SEQUENCE = "CREATE_SEQUENCE";
    public static final String INIT_SEQUENCE = "CREATE_SEQUENCE";

    private final DataSource dataSource;
    private final JdbcTemplate jdbcTemplate;
    private final DataFieldMaxValueIncrementer incrementer;
    protected final JdbcDialect jdbcDialect;

    private static final Map<JdbcDialect, Properties> types = new HashMap<JdbcDialect, Properties>();
    private static final Properties defaultTypes = new Properties();
    private static final ObjectMapper MAPPER = new ObjectMapper();

    public JdbcSupplier(DataSource dataSource, DataFieldMaxValueIncrementer incrementer,
                        JdbcDialect jdbcDialect) {
        this.dataSource = dataSource;
        this.incrementer = incrementer;
        this.jdbcTemplate = new JdbcTemplate(dataSource);
        this.jdbcDialect = jdbcDialect;
    }

    @Override
    public int count(Connection tx, Mapper mapper, JdbcKey ancestorKey, JdbcKey simpleKey, Filter... filters) {