I want to achieve the following operation using openJPA. I have two entities. USER and CITIES. I have a table USER with columns USER_NAME and CITY_DESC. I also have a table CITIES which contains columns PIN_CODE and CITY_DESC.
On the UI I get only PIN_CODE data from user. I need to save USER table making a join with CITIES table. I want CITY_DESC populated when I save USER entity using EntityManager.merge() method.
Something like this:
OpenJPA version : 2.2.2
posted 1 year ago
Assuming PIN_CODE is the primary key for the CITIES table, why not simply store the PIN_CODE in the USER table, and make that a foreign key to the CITIES table?