Hi, this is a subject that has posts here and there, but I am really not familiar with spring or JPA at all, so I need a little more detailed explanation
I had a web application with 1 persistence
unit on persistence.xml, 1 dataSource 1 entityManagerFactory and 1 transactionManager on context.xml and 1 DAO with a @PersistenceContext
So now I need to make it 2 databases, not just one, thought 2 options:
1.- 2 persistence units 1 dataSource and 1 entityManagerFactory per each one, however JpaTransactionManager works for just 1 entityManagerFactory, found that I should use Jta instead of Jpa but no idea of how to do it
2.- Use 2 persistence units and 2 DAO, Spring suggest on its documentacion, JPA section, to create 1 persistenceUnitManager, point to the persistence.xml and nothing else
My context.xml now got 2 datasources and 1 persistenceUnitManager, but when I try to run it says no persistence unit found, I assume it is because
JDBC information should be on each persistence unit and not on a bean in context.xml, is it? How I do that? And I really can't tell how my app tells which Datasource use when
Theres a 3rd option but I really didn't like it, is making a duplicate of everything and adding names even to @Transactional annotations... I don't want 2 applications running like one....
Please I would appreciate any help
PS: should I post this on ORM category too?