0

My Project has 2 mysql databases. I have written JPA's for them. But while running it gives error.

Example: Database: One Table: Table1 Database: Two Table Table2

While creating entity manager for database "One" it says "Table2" missing & While creating entity manager for database "Two" it says "Table1" missing.

Rajas Gujarathi
  • 716
  • 1
  • 9
  • 20

2 Answers2

1

In persistence.xml

Added <class>org.x.y.JPA's</class> (JPA's/Classes that are referring to that persistence unit/database) & <exclude-unlisted-classes> true </exclude-unlisted-classes> before

<properties> 
...
..
..
</properties> 
Rajas Gujarathi
  • 716
  • 1
  • 9
  • 20
0

WIth JPA you declare Persistence Unit which tells the code which data base to look at, since you have two separate databases, you will have to have multiple Persistence Units.

Take a look at the other answers on SO for hints on how to progress.

Community
  • 1
  • 1
dubes
  • 5,324
  • 3
  • 34
  • 47