Add JMH data access benchmark app

This commit is contained in:
Mikhail Yevchenko
2026-04-05 14:31:17 +00:00
commit f4ed92b415
15 changed files with 533 additions and 0 deletions
@@ -0,0 +1,32 @@
package com.benchmark.util;
import com.benchmark.model.User;
import java.sql.*;
public class DbUtil {
public static void createSchema(Connection conn) throws SQLException {
try (Statement stmt = conn.createStatement()) {
stmt.execute("""
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL,
age INTEGER NOT NULL,
created_at INTEGER NOT NULL
)
""");
}
}
public static User mapRow(ResultSet rs) throws SQLException {
return new User(
rs.getLong("id"),
rs.getString("name"),
rs.getString("email"),
rs.getInt("age"),
rs.getLong("created_at")
);
}
}