Can I write to different jetty databases using JPA that is using the same "entity class"

Posted by Per on Stack Overflow See other posts from Stack Overflow or by Per
Published on 2010-06-11T08:39:46Z Indexed on 2010/06/11 8:42 UTC
Read the original article Hit count: 168

Filed under:
|

I am using Java persistance and there EntityManager class and have it assigned to storage a class object that shall be written to the database. My problem is that I want to write to different databases using the same storage class. My solution to that was to write a StorageManagerfactory that has a Map holding all EntityManagers. The solution looked good until I looked at the databases and realized that all information (undepending of the Map, which gets the correct value) was written to the same database (one of the initialised in the Map).

So my question is: Can I write to different databases using JPA that is using the same storage class (the class holding the structure of my database)?

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about jpa