| Two entity manager appointing to the same daba base [message #553258] |
Mon, 16 August 2010 16:44  |
Mauro Flores Messages: 83 Registered: September 2009 Location: Brasil |
Member |
|
|
I'm working with a legacy database. This database is not relational and it has a proprietary query language.
There two different kinds of jdbc drivers that enable the access to it throw sql commands. One driver doesn't support insert, updates and deletes. The other supports all sql commands, but doesn't have a good query performance.
I would like to use one jdbc for queries and the other for updates, inserts and deletes.
I will work with one entity manager for each jdbc driver. The entities will be exactly the same.
My doubt is: can I update a entity with one entity manager that was loaded by the other?
The simple test below worked nice:
public void test() {
emA.getTransaction().begin();
AlunoED ed = emB.find(AlunoED.class, 16); // find uses a different EM
ed.setNomeAlu(ed.getNomeAlu() + "Alterado");
emA.merge(ed);
emA.flush();
emA.getTransaction().commit();
}
Would I face some problem using this aprouch?
Thanks. Mauro.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04202 seconds