The MySQL driver has built-in support for master-slave replication. However, how does this work with Hibernate? The PoC needs to demonstrate the following things, preferably through automated tests.
- There are two MySQL servers, one of which is routed to master/read-write by the driver, and one of which is routed to as slave/read-only by the driver.
- There can be a single Hibernate session which uses a single DB connection, but which can use the master/read-write or the slave/read-only when configured by some kind of
setReadOnly(true)
call. - We can persist entities through that Hibernate session, and we can retrieve entities through that Hibernate session.
- Caching of entities works within that single Hibernate session.