1

I am exploring ways to achieve reads from slave and writes to master on a JPA based webapp using a MySQL Master/Slave.

I think I have an option to pursue and like some opinions about past experiences achieving the same thing.

To start with , I would like to -

  • create an additional persistence Unit called readOnlyPU
  • create an additional readOnlyEntityManagerFactory that uses the readOnlyPU
  • the readOnlyPU and writeOnlyPU both share same entity objects meaning 2 different Hibernate Cache with same copy of objects.
  • when needed, use the readOnlyEntityManager in my code.

I think this approach should work, but I would like to ask about your opinion about the approach and if such approach is common for enabling Master/Slave replication .

Anand Hemmige
  • 3,593
  • 6
  • 21
  • 31

0 Answers0