{
  "id": 22887917,
  "title": "JDBC Mapping Without Reflection: Up to 117 Faster Than Spring JDBC",
  "url": "https://urgent.news/2026/12/01/jdbc-mapping-without-reflection-up-to-117-faster-than-spring-jdbc",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-01T02:42:41.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/hannyu/jdbc-mapping-without-reflection-up-to-117x-faster-than-spring-jdbc-29k"
  },
  "original_language": null,
  "account": "Mapping database results to Java objects can be costly both in terms of time and memory. SJF4J offers a solution by generating mapping code at compile time with the @CompiledJdbcMapper annotation. To use it, define a Java record and declare a mapper interface. The mapper can be accessed via the INSTANCE field, and the users method takes a ResultSet as input.\n\nConsider a benchmark comparing SJF4J against Spring JDBC and MyBatis using a 12-column result set with 1,000 rows. The results show that SJF4J is up to 117 times faster than Spring JDBC and nearly 118 times faster than MyBatis when mapping Java records. SJF4J also allocates 50 times less memory than Spring's DataClassRowMapper.\n\nSJF4J generates specialized Java code at compile time, eliminating the need for runtime object mapping. This results in faster column index resolution, typed JDBC getters, and direct object creation. The generated code closely resembles handwritten JDBC mapping, outperforming general-purpose reflective mappers.\n\nFor those who prefer to control the row loop, SJF4J also supports prepared row mapping. An interface with a prepare method takes a ResultSetMetaData and can be used to map individual rows as needed. SJF4J does not replace SQL frameworks or manage database connections; it simply accelerates the ResultSet-to-object conversion process, allowing developers to keep their SQL and JDBC code intact.",
  "summary": "SQL execution isn't the only cost of a database query. Turning a ResultSet into Java objects costs time and memory, too. What if we generated the mapping code at compile time instead? That's what SJF4J does with @CompiledJdbcMapper . A simple example Define a Java record: public record User ( long id , String userName , int age ) { } Declare a mapper: @CompiledJdbcMapper public interface…",
  "summary_source": "publisher",
  "key_points": [
    "SJF4J generates mapping code at compile time, 117 times faster than Spring JDBC",
    "Uses @CompiledJdbcMapper annotation for compile-time code generation",
    "Allocated 50 times less memory than Spring's DataClassRowMapper"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}