Skip to content
Anjunar/ DOCS

Hibernate I18n

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

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

Installation

Use Hibernate I18n 1.1.1 with a PostgreSQL DataSource and JDBC driver. Declare translations only with @Localized, @Translation and standard JPA annotations; no field lists, property readers or codecs need to be registered.

sbt
libraryDependencies += "com.anjunar" % "hibernate-i18n" % "1.1.1"
xml
<dependency> <groupId>com.anjunar</groupId> <artifactId>hibernate-i18n</artifactId> <version>1.1.1</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} @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.1.1 supports Hibernate 7.4.10.Final and PostgreSQL. Bootstrap with HibernateI18n.registryBuilder(); openSession initializes all annotated entities automatically. The reference documents the 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.