Spring Boot Multiple Datasources

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • This video explains how to configure multiple data sources in Spring Boot. We configure a weather forecast data source and a sport event datasource. Enjoy!
    Link to the code:
    github.com/eki...

Комментарии • 42

  • @subhashismohanty5420
    @subhashismohanty5420 2 года назад +1

    Good tutotrial. Thank you very much. Keep uploading such type of videos.

  • @abdallahboucedraya
    @abdallahboucedraya 3 года назад +2

    Hi,
    i have spring boot application with all the entities
    but i want connect to databases dynamically, it means when i start my application the database not exist and then somebody create the database and connect the application in the runtime without changing the application.properties
    thanks

  • @jscw2
    @jscw2 2 года назад +1

    Solid tutorial. Thanks a lot.

    • @MikesTechCorner
      @MikesTechCorner  2 года назад

      Glad it was helpful! Thank you for watching. :)

  • @abdosero463
    @abdosero463 Год назад

    Thanks a lot.

  • @__nitinkumar__
    @__nitinkumar__ 2 года назад +1

    Hi Mike,
    What is that .of() method can you please explain ?

    • @MikesTechCorner
      @MikesTechCorner  2 года назад

      Where in the vid to you see that? :)

    • @__nitinkumar__
      @__nitinkumar__ 2 года назад

      @@MikesTechCorner Hey mike, I Understood, I saw the code, you have implemented an of() method

  • @praneethyaji7808
    @praneethyaji7808 4 года назад +1

    I want to update if there are any differences in data.is that possible??

    • @MikesTechCorner
      @MikesTechCorner  4 года назад

      You need to compare the fields in the java program or just save no matter if it is the same

    • @praneethyaji7808
      @praneethyaji7808 4 года назад

      @@MikesTechCorner I want to compare and update if data in other columns except primary key column is different,insert if primary key is not present. How can I compare data of two tables ??

  • @zaheerahmed2614
    @zaheerahmed2614 3 года назад +1

    Good tutorial Thanks, Question is that In one Db can have many tables which are actually entity and persistenceUnit is an entity also, how can we manage multiple persistenceUnit in a DBConfig class?

  • @skipa9906
    @skipa9906 2 года назад +1

    great video. How can I make an update to source A and then B and C also get updated? Souce A to be the center

    • @MikesTechCorner
      @MikesTechCorner  2 года назад +1

      I don't know and you should avoid multiple datasources in general. Have the master system of each database expose REST endpoints instead.

    • @skipa9906
      @skipa9906 2 года назад

      @@MikesTechCorner Thank you.

  • @ayoubzitrone2186
    @ayoubzitrone2186 2 года назад +1

    Hello , is possible to join the tables ? Like @OnetoMany ?
    Thanks a lot .

    • @MikesTechCorner
      @MikesTechCorner  2 года назад +1

      Not between datasources. In that case you would create a service that selects from both datasources and then merge the result into 1 Java class.

  • @SrikarRao
    @SrikarRao 4 года назад +1

    could you please help us, how to configure spring boot with mysql & mongodb (or aws documentDB).. In addition to that please explain how to work with transaction on both databases.
    A use case where a method updates both databases and rollback transaction if something goes wrong..

    • @MikesTechCorner
      @MikesTechCorner  4 года назад

      Yes

    • @SrikarRao
      @SrikarRao 4 года назад +1

      @@MikesTechCorner thanks for your quick response and I just updated mu original comment to add more details..plz have a look at it

    • @MikesTechCorner
      @MikesTechCorner  4 года назад

      @@SrikarRao i have added this to my to-do list. Its an interesting subject

    • @SrikarRao
      @SrikarRao 4 года назад +1

      ​@@MikesTechCorner, could you please notify me when you post new video with my request.

    • @MikesTechCorner
      @MikesTechCorner  4 года назад +1

      Here is what you requested: ruclips.net/video/qOfdE-cFzto/видео.html

  • @LaVerguenzaDeTwitch
    @LaVerguenzaDeTwitch 4 года назад +1

    thanks so much for your tutorial.
    now i have question, if i have more than one entity in both datasource, what changes i need to do and where?

    • @MikesTechCorner
      @MikesTechCorner  4 года назад +1

      You just add the entities in the right packages. If you have an entity in both db's then create 2 classes. One in the package for db no 1 and one in the package for db no 2.

    • @LaVerguenzaDeTwitch
      @LaVerguenzaDeTwitch 4 года назад +1

      ​@@MikesTechCorner Nice, this works for me, i love you

  • @norbertoenomoto7653
    @norbertoenomoto7653 5 лет назад +2

    Hello. Coud you please share the code?

    • @MikesTechCorner
      @MikesTechCorner  5 лет назад

      Yes Ill look into it tomorrow

    • @MikesTechCorner
      @MikesTechCorner  5 лет назад

      Hi Norberto. I have added a link with the code in the description field. Thanks for watching my video. github.com/ekim197711/springboot-multiple-datasources