Hi everyone ! I'm facing a problem on trying to get Tapestry 5.3.7 to use multiple JPA database for same application.
I do have an administration console with a big options menu. In order to speedup some of the functionality, i defined an extra database that will be queried against. My problem lies in that looks like 2 EntityManagers can't manage the same entities. I've check tapestry-jpa src-code, and the problem? lies in here : Class JPAModule.java <pre> @Contribute(ApplicationStateManager.class) public static void provideApplicationStateContributions( final MappedConfiguration<Class, ApplicationStateContribution> configuration, final EntityManagerSource entityManagerSource, @Symbol(JpaSymbols.ENTITY_SESSION_STATE_PERSISTENCE_STRATEGY_ENABLED) final boolean entitySessionStatePersistenceStrategyEnabled) { if (!entitySessionStatePersistenceStrategyEnabled) return; for (final PersistenceUnitInfo info : entityManagerSource.getPersistenceUnitInfos()) { final EntityManagerFactory emf = entityManagerSource.getEntityManagerFactory(info.getPersistenceUnitName()); final Metamodel metamodel = emf.getMetamodel(); for (EntityType<?> entity : metamodel.getEntities()) { configuration.add(entity.getJavaType(), new ApplicationStateContribution(JpaPersistenceConstants.ENTITY)); } } } </pre> As you can see, for every entity, tapestry is adding the entity type to the share configuration. As Entity X is already managed by configuration for Database1, when same Entity X from Database2 is added to the configuration, it just throws an Exception. How can i fix this ? I do REALLY need the same instance managed by both instances. Thanks a lot.