0

I'm working on a project which has 3 different persistence units. I have a BaseDaoImpl which has an entitymanager (with persistence unit "A") and all the CRUD operations. BaseDaoImpl will be extended by other DAO classes.

I'm stuck in a situation where my application would require to talk to different persistence units. For instance, entitymanager with persistence unit "A" and entitymanager1 with persistence unit "B".

But my BaseDaoImpl has entitymanager(PU="A"), if I access the TestDAO with Test as its entity (belongs to PU="A") I won't be able to access other entities belonging to other Persistence Units.

I would like to design a solution which has minimal changes. BaseDaoImpl should remain intact and it should accommodate CRUD operations with entity manager (belonging to any of the persistence units).

For example, with my entitymanager if I have to read the record I would do this.entitymanager.getRecord(1). If I have to read the record from other persistence unit I would like to read it the same way. Application should be smart enough to determine on which entity manager the operation should be performed.

Any help would be appreciated. Thanks in advance :)

Karthik
  • 1
  • 1

0 Answers0