I have two different (entity1 and entity2) mapped (@OneToOne or @OneToMany) entities from two different database schemas (db1 and db2).
If I try traditional ways, I got errors that are about "db1.entity2 does not exist". Because entity1 is in db1 and entity2 is in db2.
I tried to fill all the entity1 objects with entity2 objects after findAll();. But it takes a lot of time (more than 20 sec.)
Is there any way to map them to each other or fill after in a quick way?
Note: I can not get all the entity2 data from the database each time. Because there are a lot.
Note 2: I will try to get entity2 objects I need, with Native Query by the list of id.
I use the last version of Spring Boot JPA Projection, MySQL db, and Java 11.