Hi all,
I've tried Googling and searching the forums for this, but can't find any satisfactory answers.
How exactly does one specify that all write transactions go to one datasource, and all read transactions go to another in Hibernate?
I'm writing a Java webapp that needs to be easily horizontally scaled in a cloud environment. We'll be using MySQL, with the master being used for writes and a series of slaves for reads, which I believe is a pretty common usage model. When we need to scale the appserver tier, we'll be using EHCache as a 2L cache for Hibernate.
I gather setting up two session factories is one approach, but is there a 'transparent' way that I can get Hibernate to redirect writes/reads through config, instead of my code having to make the decision itself?
Thanks in advance for any help.
|