2

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 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

dead link "Hibernate: Managing multiple databases and schemas"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.