Skip to content
Anjunar/ DOCS

Hibernate I18n

Typed entity fields backed by relational translations, with one content locale per Session.

1.0.0Current release
JVM / Java 17+Runs on
Scala 3.9Language version
MITLicense

Installation

Add the 1.0.0 runtime from Maven Central. It brings the annotation module and Hibernate DDL Manager 1.2.0 transitively; provide a PostgreSQL DataSource and JDBC driver.

sbt
libraryDependencies += "com.anjunar" % "hibernate-i18n" % "1.0.0"
xml
<dependency> <groupId>com.anjunar</groupId> <artifactId>hibernate-i18n</artifactId> <version>1.0.0</version> </dependency>

Ordinary types, localized storage

The entity keeps a String title. The runtime bootstrap generates the separate translation mapping.

scala
import com.anjunar.hibernatei18n.annotation.{Localized, Translation} import com.anjunar.hibernateddl.hibernate.annotation.SchemaId import jakarta.persistence.{Entity, Id, Table} import java.util.UUID import scala.compiletime.uninitialized @Entity @Table(name = "page") @SchemaId("7f3a9c21") @Localized(defaultLocale = "en", fallbackLocale = "en") class Page: @Id @SchemaId("0a1b2c3d") var id: UUID = uninitialized @Translation @SchemaId("f34e45b6") var title: String = uninitialized
01 / Fields

Keep the domain types

Strings and converted values remain ordinary entity properties; their persistent values belong to locale rows.

02 / Locale

One Session, one language

Loading and queries share a fixed content locale and resolve fallback separately for each translated field.

03 / Editor

Edit exact overrides

A typed handle edits inactive locales while the managed entity retains its loaded language.

Supported runtime

Version 1.0.0 supports Hibernate 7.4.10.Final and PostgreSQL. Bootstrap with HibernateI18n.registryBuilder() and install every localized entity before opening Sessions. The reference documents the supported mapping and lifecycle contract.

Contents

From the mapping to the editor

Start with the entity mapping and bootstrap, then follow the Session, editor and schema guides.