• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Integrate multiple JPA projects

 
TH Lu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi people,

I'm getting some trouble on the integration of two JPA projects.
This is my scenario:

I have a table EMPLOYEE with its entity class mapped into EmployeeJPAProject and a table ADDRESS mapped into AddressJPAProject (each project has its own persistence.xml).
There's another table EMPLOYEE_ADDRESS in the database, which hold information about the relationship between EMPLOYEE and ADDRESS.

In the entity class for EMPLOYEE, the Employee.java, I inserted the following annotation:


With the code stated as above, I'm getting an error message "Referenced column "ID_ADDR" in join column "ID_ADDR" cannot be resolved".
I suspect the error happend because the entity class for ADDRESS is declared in a project different from EmployeeJPAProject and therefore JPA wasn't able to find the ADDRESS entity declaration.
Does anyone can give me some hints about how to make these two projects working together without changing the project structure?

Thanks.
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that the entities used in mappings have to be in the same persistence unit (the JPA term for your "project") and therefore, integration should include merging those two units.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic