This is my first project with Hibernate and so far I'm reasonably pleased. I've run into a few snags and it's taken a bit of time to learn the 'hibernate' way but I certainly embrace not having to write my own SQL anymore!
Anyways, one topic I haven't seen addressed much is just how to make Hibernate scale horizontally across machines and DB's. One solution is to use a clustered DB solutions such as MySQL Cluster, but I've had very bad experience with MySQL cluster's stability.
I'd much rather use replication and use a master/slave pattern, since as with most web apps, mine is mostly read and rarely write.
How is this addressed in Hibernate?
MySQL supports it's own master/slave DB connection:
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-replication-connection.html
But I'm not sure how to plug this into c3p0 and Hibernate. What is the typical pattern to mark a connection as not read only and therefore that it should use the master DB and not one of the replicated slaves?
If this isn't the typical path, what is? Is everybody just living under the assumption that their app will always scale with one machine and DB and sticking their head in the sand with respect to high availability?
Please say it ain't so! :)
Thanks,
-Nic