With hibernate, I want to b开发者_如何学编程e able to support multiple databases, one for read and one for writes.
Is this possible? Is the only way to create 2 separate session objects?
You answered your first question by your 2nd question. So, now for your second question. Yes, of course you will need separate sessions. Better say, you need several session factories for to support multiple database.
Hibernate: Managing multiple databases and schemas.
For more, look into Hibernate Shards. Shard might not sound like a good idea, because it requires one session factory per database schema. And here I found the relevant thread at JavaRanch Forum.
精彩评论