// Path: src/main/java/org/sfm/beans/SmallBenchmarkObject.java
// @Entity
// @Table(name="test_small_benchmark_object")
// public class SmallBenchmarkObject {
// 	
// 	@Id
// 	@RowMapperField(columnName="ID")
// 	private long id;
// 
// 	@RowMapperField(columnName="YEAR_STARTED")
// 	private int yearStarted;
// 	@RowMapperField(columnName = "NAME")
// 	private String name;
// 	@RowMapperField(columnName="EMAIL")
// 	private String email;
// 
// 	@Column(name="ID")
// 	public long getId() {
// 		return id;
// 	}
// 	public void setId(long id) {
// 		this.id = id;
// 	}
// 	@Column(name="NAME")
// 	public String getName() {
// 		return name;
// 	}
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 	@Column(name="EMAIL")
// 	public String getEmail() {
// 		return email;
// 	}
// 	public void setEmail(String email) {
// 		this.email = email;
// 	}
// 	
// 	@Column(name="YEAR_STARTED")
// 	public int getYearStarted() {
// 		return yearStarted;
// 	}
// 	public void setYearStarted(int yearStarted) {
// 		this.yearStarted = yearStarted;
// 	}
// 	@Override
// 	public String toString() {
// 		return "SmallBenchmarkObject [id=" + id + ", yearStarted="
// 				+ yearStarted + ", name=" + name + ", email=" + email + "]";
// 	}
// 	
// 	
// }
// 
// Path: src/main/java/org/sfm/benchmark/db/jmh/ConnectionParam.java
// @State(Scope.Benchmark)
// public class ConnectionParam {
// 
// 	@Param(value="MOCK")
// 	public DbTarget db;
// 
// 	public DataSource dataSource;
// 	
// 	@Setup
// 	public void init() throws SQLException, NamingException {
// 		dataSource = ConnectionHelper.getDataSource(db);
// 		
// 		if (db != DbTarget.MOCK) {
// 			Connection conn = dataSource.getConnection();
// 			try {
// 				ConnectionHelper.createTableAndInsertData(conn);
// 			} finally {
// 				conn.close();
// 			}
// 		}
// 	}
// 	
// 	public Connection getConnection() throws SQLException {
// 		return dataSource.getConnection();
// 	}
// }
// 
// Path: src/main/java/org/sfm/benchmark/db/jmh/LimitParam.java
// @State(Scope.Benchmark)
// public class LimitParam {
// 	@Param(value={"1", "10", "100", "1000", "10000", "100000", "1000000"})
// 	public int limit;
// }


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.Blackhole;
import org.sfm.beans.SmallBenchmarkObject;
import org.sfm.benchmark.db.jmh.ConnectionParam;
import org.sfm.benchmark.db.jmh.LimitParam;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
package org.sfm.benchmark.db.spring;



@State(Scope.Benchmark)
public class BeanPropertyRowMapperBenchmark  {
	
	private BeanPropertyRowMapper<SmallBenchmarkObject> mapper;
	
	@Setup
	public void init() {
		mapper = new BeanPropertyRowMapper<SmallBenchmarkObject>(SmallBenchmarkObject.class);
	}
	
	@Benchmark
	public void testQuery(ConnectionParam connectionHolder, LimitParam limit, final Blackhole blackhole) throws Exception {
		Connection conn = connectionHolder.getConnection();
		try {
			PreparedStatement ps = conn.prepareStatement("SELECT id, name, email, year_started FROM test_small_benchmark_object LIMIT ?");
// Path: src/main/java/org/sfm/beans/SmallBenchmarkObject.java
// @Entity
// @Table(name="test_small_benchmark_object")
// public class SmallBenchmarkObject {
// 	
// 	@Id
// 	@RowMapperField(columnName="ID")
// 	private long id;
// 
// 	@RowMapperField(columnName="YEAR_STARTED")
// 	private int yearStarted;
// 	@RowMapperField(columnName = "NAME")
// 	private String name;
// 	@RowMapperField(columnName="EMAIL")
// 	private String email;
// 
// 	@Column(name="ID")
// 	public long getId() {
// 		return id;
// 	}
// 	public void setId(long id) {
// 		this.id = id;
// 	}
// 	@Column(name="NAME")
// 	public String getName() {
// 		return name;
// 	}
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 	@Column(name="EMAIL")
// 	public String getEmail() {
// 		return email;
// 	}
// 	public void setEmail(String email) {
// 		this.email = email;
// 	}
// 	
// 	@Column(name="YEAR_STARTED")
// 	public int getYearStarted() {
// 		return yearStarted;
// 	}
// 	public void setYearStarted(int yearStarted) {
// 		this.yearStarted = yearStarted;
// 	}
// 	@Override
// 	public String toString() {
// 		return "SmallBenchmarkObject [id=" + id + ", yearStarted="
// 				+ yearStarted + ", name=" + name + ", email=" + email + "]";
// 	}
// 	
// 	
// }
// 
// Path: src/main/java/org/sfm/benchmark/db/jmh/ConnectionParam.java
// @State(Scope.Benchmark)
// public class ConnectionParam {
// 
// 	@Param(value="MOCK")
// 	public DbTarget db;
// 
// 	public DataSource dataSource;
// 	
// 	@Setup
// 	public void init() throws SQLException, NamingException {
// 		dataSource = ConnectionHelper.getDataSource(db);
// 		
// 		if (db != DbTarget.MOCK) {
// 			Connection conn = dataSource.getConnection();
// 			try {
// 				ConnectionHelper.createTableAndInsertData(conn);
// 			} finally {
// 				conn.close();
// 			}
// 		}
// 	}
// 	
// 	public Connection getConnection() throws SQLException {
// 		return dataSource.getConnection();
// 	}
// }
// 
// Path: src/main/java/org/sfm/benchmark/db/jmh/LimitParam.java
// @State(Scope.Benchmark)
// public class LimitParam {
// 	@Param(value={"1", "10", "100", "1000", "10000", "100000", "1000000"})
// 	public int limit;
// }


// Path: src/main/java/org/sfm/benchmark/db/spring/BeanPropertyRowMapperBenchmark.java
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.Blackhole;
import org.sfm.beans.SmallBenchmarkObject;
import org.sfm.benchmark.db.jmh.ConnectionParam;
import org.sfm.benchmark.db.jmh.LimitParam;
import org.springframework.jdbc.core.BeanPropertyRowMapper;

package org.sfm.benchmark.db.spring;



@State(Scope.Benchmark)
public class BeanPropertyRowMapperBenchmark  {
	
	private BeanPropertyRowMapper<SmallBenchmarkObject> mapper;
	
	@Setup
	public void init() {
		mapper = new BeanPropertyRowMapper<SmallBenchmarkObject>(SmallBenchmarkObject.class);
	}
	
	@Benchmark
	public void testQuery(ConnectionParam connectionHolder, LimitParam limit, final Blackhole blackhole) throws Exception {
		Connection conn = connectionHolder.getConnection();
		try {
			PreparedStatement ps = conn.prepareStatement("SELECT id, name, email, year_started FROM test_small_benchmark_object LIMIT ?");
			try {