// Path: src/main/java/ca/krasnay/sqlbuilder/PostgresqlDialect.java
// public class PostgresqlDialect implements Dialect, Serializable {
// 
//     private static final long serialVersionUID = 1;
// 
//     public String createCountSelect(String sql) {
//         return "select count(*) from (" + sql + ") a";
//     }
// 
//     public String createPageSelect(String sql, int limit, int offset) {
//         return String.format("%s limit %d offset %d", sql, limit, offset);
//     }
// 
//     @Override
//     public Supplier<Integer> getSequence(DataSource dataSource, String sequenceName) {
//         return new PostgresqlSequence(dataSource, sequenceName);
//     }
// }


import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import junit.framework.TestCase;
import org.h2.jdbcx.JdbcDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import ca.krasnay.sqlbuilder.PostgresqlDialect;
package ca.krasnay.sqlbuilder.orm;




public class MappingTest extends TestCase {

    public static class Employee {
        private int id;
        private int version;
        private String name;
    }

    public void testAll() throws Exception {

        Class.forName("org.h2.Driver");
        JdbcDataSource ds = new JdbcDataSource();
        ds.setURL("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");

        JdbcTemplate t = new JdbcTemplate(ds);

        t.update("create table Employee (id int primary key, version int not null, name varchar(255))");
        t.update("create sequence myseq start with 1");

// Path: src/main/java/ca/krasnay/sqlbuilder/PostgresqlDialect.java
// public class PostgresqlDialect implements Dialect, Serializable {
// 
//     private static final long serialVersionUID = 1;
// 
//     public String createCountSelect(String sql) {
//         return "select count(*) from (" + sql + ") a";
//     }
// 
//     public String createPageSelect(String sql, int limit, int offset) {
//         return String.format("%s limit %d offset %d", sql, limit, offset);
//     }
// 
//     @Override
//     public Supplier<Integer> getSequence(DataSource dataSource, String sequenceName) {
//         return new PostgresqlSequence(dataSource, sequenceName);
//     }
// }


// Path: src/test/java/ca/krasnay/sqlbuilder/orm/MappingTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import junit.framework.TestCase;
import org.h2.jdbcx.JdbcDataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import ca.krasnay.sqlbuilder.PostgresqlDialect;

package ca.krasnay.sqlbuilder.orm;




public class MappingTest extends TestCase {

    public static class Employee {
        private int id;
        private int version;
        private String name;
    }

    public void testAll() throws Exception {

        Class.forName("org.h2.Driver");
        JdbcDataSource ds = new JdbcDataSource();
        ds.setURL("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");

        JdbcTemplate t = new JdbcTemplate(ds);

        t.update("create table Employee (id int primary key, version int not null, name varchar(255))");
        t.update("create sequence myseq start with 1");

        OrmConfig ormConfig = new OrmConfig(ds, new PostgresqlDialect());