-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation showing how to use two different databases #3456
Comments
Example is here https://github.com/eepstein/multids-demo |
There is also https://github.com/snicoll-demos/demo-multi-entity-managers that is meant to demonstrate the JPA/Spring Data use case with two datasources and Spring Boot. |
The documentation has also been updated as well. |
Can we reopen this issue? The example from https://github.com/snicoll-demos/demo-multi-entity-managers is really helpful for spring-boot 1.x But the documentation for spring-boot 2.x does not tell us about how to separate (or setup) domain objects/packages to specific datasource (is we have more than one). It also unclear how to setup special hibernate properties (for example) for each datasource and how a test can look (with a database auto creation and sql import like the "import.sql" feature worked for 1.x). The mentioned example https://github.com/eepstein/multids-demo does no longer exists. I would like to help to create a spring-boot 2.x example if somebody can help me to figure out how to do this. So I can start with a example repo (which I have already on my local) where at the end the tests are failing because of some missing peaces. Thanks in advance |
@waffel I've re-opened the issue but it might take a while for us to get to this. Feel free to share the sample that you have created so far. |
thanks 👍 I have managed to get it work with spring boot 2.0.1 .. I will start to create a demo repo and link it here .. there are some open topics which we can discuss on the demo repo or here. |
follow the comments from mybatis/spring-boot-starter#78, I set it up successfully, but I run into the issue database initialize. when there is just one datasource it works well. but when there are two database, springboot does not pick up the schema-{platform}.sql. In my case it does not pick up schema-h2.sql. but if I rename schema-h2.sql to schema.sql. then it can load. |
and I have schema-h2.sql and schema-mysql.sql files in classpath |
@kcmvp please do not hijack this issue to ask questions. We use StackOverflow or Gitter for that. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Can i work on it? |
@rahul404 In retrospects, I am not sure why it was flagged ideal for contribution. It looks like upgrading my sample to SB 2 would already be a good way forward but given the feedback we got so far, I think it should be more prominent than its current location. |
See also #14928 |
We think that a guide would be a better way to describe how to proceed with this. We'll upgrade the current sample and move it to a guide. |
It would be nice to get a working example, how to use and configure two databases in spring boot.
The documentation says, that it is only required to create a datasource configuration with two different datasources.
But this does not work complete. The example application can show how to:
data-${platform}.sql
files to add data to two different test databasesCrudRepository
interfaceI have not found any "complete" example for this. But it is mentioned in the documentation, that this is easy and supported by spring-boot .. so it would be nice to have such example.
The text was updated successfully, but these errors were encountered: