# Two databases, each with its own DataSource, Flyway, EntityManagerFactory and transaction manager --- the two DataSources (one pool each, configured separately) --- customersDataSource pool=customers-pool max=4 url=jdbc:h2:mem:customers primary=true ordersDataSource pool=orders-pool max=8 url=jdbc:h2:mem:orders primary=false --- Flyway ran once per database, each with its own history --- customers flyway_schema_history: [1 customer] orders flyway_schema_history: [1 purchase order, 2 index customer] --- what each EntityManagerFactory manages --- EntityManagerFactory beans: [customersEntityManagerFactory, ordersEntityManagerFactory] customersEntityManagerFactory entities=[Customer] ordersEntityManagerFactory entities=[PurchaseOrder] --- transaction managers --- beans: [customersTransactionManager, ordersTransactionManager] customersTransactionManager primary=true ordersTransactionManager primary=false --- save one customer and one order through the two repositories --- customers database tables: [CUSTOMER, flyway_schema_history] orders database tables: [PURCHASE_ORDER, flyway_schema_history] rows: customers.customer=1 orders.purchase_order=1