views:

74

answers:

1

With hibernate, I want to be 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?

+1  A: 

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.

Adeel Ansari