Skip to content
Anjunar/ DOCS

Scope and limits

Version 1.0 for PostgreSQL 14+ and Hibernate ORM 7.4, with a deliberately narrow scope. What is outside is refused with a message, never guessed.

Mapping

What can be mapped

Entities with the common basic types and everything Hibernate usually generates around them.

Supported
Basic types, enums, @Lob, JSON columns (jsonb).
Generated keys: UUIDs, sequences, identity columns.
Inheritance with all three strategies.
@ManyToOne, @OneToOne and @ManyToMany associations.
Element collections: sets, lists, ordered lists and maps.
Secondary tables, unique constraints and indexes.
Changes

What the executor plans

It creates, renames, adds and widens. Widening means a longer VARCHAR, INTEGER to BIGINT, or a larger NUMERIC precision with the same scale.

Planned

Without a decision

Create, rename, add, widen; replace and drop indexes and unique keys.

Approved

With an approval

Drops, renames back, reverts, and dropping a unique key whose columns stay.

Refused

With a message

Arrays, collections inside embeddables, any other type change, primary key changes.

Special cases

Large objects and JSON documents

Two mappings behave differently from what their annotations suggest.

@Lob leaves orphans behind

Hibernate stores @Lob, Blob and Clob on PostgreSQL as large objects in oid columns. PostgreSQL does not delete them with their row. Run vacuumlo regularly; the lo_manage trigger is no option because the executor refuses triggers on managed tables.

JSON columns hold documents

@JdbcTypeCode(SqlTypes.JSON) maps a value to one jsonb column; on an @Embedded property the whole embeddable becomes one document. An enum or non-null property inside it would need a table check the model cannot represent, so it is refused.

Modules

Six sbt projects

Package root com.anjunar.hibernateddl. The core depends neither on Hibernate nor on a database driver.

schema-core
Model, validation, diff, operations.
schema-hibernate
@SchemaId and HibernateSchemaSource.
schema-executor
Transaction, planning against the stored model, history, preview.
schema-postgresql
SQL, catalog checks, locking and history for PostgreSQL.
schema-integration
HibernateSchemaMigration and the opt-in integrator.
schema-cli
Demo and the read-only preview command. Not published.