Delivering Your Digital Vision

Posts Tagged ‘java’

Implementing I18N relationships with JPA

No Comments

I have seen quite a bit of discussion about how to address database relationships that involve a base table and an internationalized (I18N) table with JPA. The difficult issue with this relationship is that from a database perspective it is a typical One-to-Many, however from an application perspective it is a One-to-One with the locale determining which row from the I18N table is returned with the base table. This article describes one possible solution for addressing this problem.

From what I have been able to determine, there is no specific support in JPA to address this. There is a mechanism in OpenJPA but the locale is fixed so it can’t be changed dynamically at run time. With the lack of native JPA support for I18N, I decided to develop my own strategy for tackling the issue.
Read the rest of this entry »