Locales and queries
Load, edit, filter and page in a fixed Session locale, with fallback resolved per field.
Bind language to the Session
The content locale is immutable for a Session. Use a new Session for another language and ordinary managed properties for active-locale writes.
A transactional title edit
Load in German, edit the normal String field, then commit. Roll back failures and always close the Session.
- exact locale → language → fallbackLocale → defaultLocale
- The lookup is per field. A missing title can fall back while another field still uses the active locale.
Setting a translated property to null clears its active-locale override. Refresh or a new Session reads the fallback; clearing the last field removes the empty translation row.
Filter and page by translated values
HQL and Criteria operate on the locale-resolved property. Ordering and paging therefore use the same translated value as loading.
A localized HQL page
Run inside a localized Session and transaction. The active language and fallback determine the predicate and order.