2

I have two data sources having exactly same schema but one is read-only and other is read/write. The read-only data source get updated by the external project. I am planning to using spring-data-hibernate to create entity model classes and read data from the read-only data source and write to read/write data source.

Is it do-able? Do we have any best practices/design patterns regarding it?

1 Answer 1

2

Take a look at: http://spring.io/blog/2007/01/23/dynamic-datasource-routing/

Spring has an AbstractRoutingDataSource that allows you to define multiple data resources on your server which will let spring pick them up and allows you to define which ones are read from and which ones are written to.

I could go into more depth, but the link will take you to a good discussion about it.

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

2 Comments

Thanks for your reply. I will try it out over weekend.
I have to move to another high priority task. I will be looking into this next week. I will post my solution here.

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.