Skip to main content

How Typr Compares

Typr isn't the first tool to generate code from database schemas. Here's an honest comparison with the alternatives.

Quick Comparison​

FeatureTyprjOOQExposedHibernate
ApproachSchema-first codegenSchema-first codegenCode-first DSLCode-first ORM
LanguagesJava, Kotlin, ScalaJava (Kotlin via Java)KotlinJava, Kotlin
Databases6 (Pg, Maria, Oracle, SQL Server, DuckDB, DB2)30+6Most
ID typesGenerated distinct typesNoNoNo
SQL filesFirst-class, typedVia plain SQLNoVia native queries
API generationYes (OpenAPI)NoNoNo
LicenseBSL 1.1Dual (commercial for Oracle/SQL Server)Apache 2.0LGPL

jOOQ​

jOOQ is the most established schema-first code generator for Java. It's mature, well-documented, and has excellent database support.

Where jOOQ excels:

  • 30+ databases supported
  • Mature, battle-tested (10+ years)
  • Excellent documentation
  • Active development and support

Where Typr differs:

AspectjOOQTypr
ID typesAll IDs are raw types (Long, UUID)Distinct types (UserId, OrderId) that can't be mixed up
SQL filesWrite DSL or embed stringsWrite .sql files, get typed methods
Multi-languageJava-first, Kotlin via interopNative idioms for Java, Kotlin, and Scala
NullabilityNullable by defaultPrecise: Optional/Option/? only where schema allows null
API layerDatabase onlyDatabase + OpenAPI in one type system
Oracle/SQL ServerCommercial license requiredSupported

Choose jOOQ if: You need maximum database coverage, prefer a mature ecosystem, or your team is already using it.

Choose Typr if: You want distinct ID types, native multi-language support, or unified database + API types.

Exposed (Kotlin)​

Exposed is JetBrains' SQL library for Kotlin. It's code-first: you define your schema in Kotlin, then use it.

Where Exposed excels:

  • Pure Kotlin, idiomatic API
  • JetBrains backing
  • Good for greenfield Kotlin projects
  • DSL and DAO patterns

Where Typr differs:

AspectExposedTypr
DirectionCode defines schemaSchema defines code
Existing schemasMust recreate in codePoint at existing DB, generate
Type generationManualAutomatic
ID typesManual wrapper classesGenerated automatically
SQL filesNot supportedFirst-class

Choose Exposed if: You're starting fresh with Kotlin and want to define schema in code.

Choose Typr if: You have an existing schema, want generated types, or need Java/Scala support.

Hibernate / JPA​

Hibernate is the incumbent ORM. Most Java developers have used it.

Where Hibernate excels:

  • Ubiquitous, everyone knows it
  • Massive ecosystem
  • Handles complex object graphs
  • Caching, lazy loading, change tracking

Where Typr differs:

AspectHibernateTypr
PhilosophyObjects are truth, DB is persistenceDB schema is truth, code reflects it
MappingAnnotations on entitiesGenerated from schema
ID safetyAll Long or UUIDDistinct types per table
SQL controlHidden (mostly)Explicit
Schema changesRuntime errorsCompile errors
N+1 queriesEasy to create accidentallyExplicit fetching

Choose Hibernate if: You need an ORM with caching, lazy loading, and your team knows it.

Choose Typr if: You want schema-first, explicit SQL, and compile-time safety over runtime magic.

sqlc (Go)​

sqlc is a SQL-first code generator for Go. It's philosophically similar to Typr.

Where sqlc excels:

  • SQL files as first-class citizens
  • Fast, simple
  • Growing ecosystem

Where Typr differs:

AspectsqlcTypr
LanguageGoJava, Kotlin, Scala
DatabasesPostgreSQL, MySQL, SQLite6 including Oracle, SQL Server, DB2
Repository generationNoYes (CRUD for every table)
ID typesNoYes
DSLNoYes
API generationNoYes (OpenAPI)

Choose sqlc if: You're in the Go ecosystem.

Choose Typr if: You're on the JVM.

pgtyped (TypeScript)​

pgtyped generates TypeScript types from SQL files for PostgreSQL.

Where pgtyped excels:

  • Great TypeScript integration
  • SQL file approach
  • Active development

Where Typr differs:

AspectpgtypedTypr
LanguageTypeScriptJava, Kotlin, Scala
DatabasesPostgreSQL only6 databases
Repository generationNoYes
ID typesNoYes

Choose pgtyped if: You're in TypeScript + PostgreSQL.

Choose Typr if: You're on the JVM or need multiple databases.

The Typr Difference​

Across all comparisons, Typr's unique combination is:

  1. Distinct ID types - UserId and OrderId are different types. No other JVM tool does this automatically.

  2. SQL files with typed output - Write .sql, get methods with correct parameter and return types.

  3. Database + API in one type system - The same UserId in your database code and your OpenAPI handlers.

  4. Multi-language, native idioms - Not "Java with Kotlin interop" but actual idiomatic code for each language.

  5. Enterprise databases supported out of the box - Oracle, SQL Server, DB2 alongside the open-source ones.

When NOT to Use Typr​

Be honest with yourself:

  • Greenfield with simple schema? Exposed or even raw JDBC might be simpler.
  • Need 30+ databases? jOOQ has broader coverage.
  • Heavy ORM features (caching, lazy loading)? Hibernate is purpose-built for that.
  • Team already productive with existing tool? Migration cost may not be worth it.
  • Not on the JVM? Look at sqlc (Go), pgtyped (TypeScript), or Prisma.

Typr shines when you have:

  • An existing schema you can't change
  • Multiple team members with varying experience
  • A need for compile-time safety at database and API boundaries
  • Oracle, SQL Server, or DB2 at a fraction of jOOQ's enterprise pricing