Thank you, brother, on July 25th, 2023 at 2:15 AM in the United States you solved my problem. Thanks for this video. Wish you all good.
@sonujadon32555 жыл бұрын
interview point of view this video is very important , those who wants the Resume Spring Boot
@Shafmohaa2 жыл бұрын
Thank you, 4 years old but still works
@vinitgawali1 Жыл бұрын
Awesome this is exactly what i was looking for. This question asked me in interview repeatedly
@arnobchowdhury31913 жыл бұрын
Sir, you can put a payment link for donation, you are doing a lot good for free and you deserve something in return.
@veenatiwari47943 жыл бұрын
Agreed with you and .. hands up to his efforts 🙏
@nitsbobby5 жыл бұрын
Thank you so much for sharing the knowledge on multiple datasource usage in MS.
@surjeetmohanty42145 жыл бұрын
This tutorial actually i am looking for.Thanku.
@deepakkasturirangan43833 жыл бұрын
Datasource are mapped using keys with domain-name (from 7.09) Syntax: "spring...url = xxx" instead of "spring..url = xxx"
@LOKESHPANDEYjob20144 жыл бұрын
Just for the readers, hbm2ddl.auto=update is discouraged in production. Better use dbProperties.put("hibernate.hdm2ddl.auto", "validate");
@nagarjunareddykanala93185 жыл бұрын
Thanks for the video it's clear and useful for attending interviews
@boikimphore78453 жыл бұрын
Great tutorial, it has helped me with one of the most important tasks I had to do.
@veenatiwari86213 жыл бұрын
Thank you so much sir for your hard efforts for us to make us with easy learn. Awesome and very helpful videos and you also explain the concept very well. Thanks , i took reference of your this code and videos to implement my task, now i need to connect my API with 3 database as @primary will help for between two database .. as for three database i am getting , how i can mange it with qualifier or any other ways for the same. Thanks for your hard efforts as you bring knowledgeable videos. Thanks.
@Javatechie3 жыл бұрын
Thanks Veena , What difficulty you are facing while connect to 3 different datasource however approach is same
@nagarjunareddykanala93185 жыл бұрын
Very helpful Basant super
@vijayakumarkrishnan92695 жыл бұрын
Thanks for the step by step execution dear Friend! Actually, I have downloaded a copy but it was not working for me. when I watched this video I corrected a few things in the code and it was working fantastically.
@Javatechie5 жыл бұрын
Thanks Vijaya , Could you please update here if you found any issue with same code
@vijayakumarkrishnan92695 жыл бұрын
@@Javatechie I have downloaded some different Code friend. Not your code. Your code works seamlessly fine :)
@vijayakumarkrishnan92695 жыл бұрын
However, I would like to know how to send data as a JSON to the endpoint? because what I could see is that passing the values to Model classes in a program itself. I want to know how to do it dynamically at run time with postman?
@Javatechie5 жыл бұрын
@@vijayakumarkrishnan9269 this is backend code that's why I tried with postman but if you want data in real time scenario then it should be pass through client (angular, Ajax)
@vijayakumarkrishnan92695 жыл бұрын
@@Javatechie Yes, exactly, I have a client app which submits the data from a web form to backend endpoint via Ajax post. but would like to know how to process Ajax data in backend repository code or in the controller.
@SatyamKumar-mq3qf5 жыл бұрын
thank you basant bhaiya
@arnobchowdhury31913 жыл бұрын
Love java tikki.. Great job
@Javatechie3 жыл бұрын
Typo javatechie 🤪, anyway thanks
@2RAJ2121 күн бұрын
Thank you.
@curiouspragyan19382 жыл бұрын
Thank you so much sir
@rupalilokhande26563 жыл бұрын
Awesome :) Exactly what I am looking for :) Thanks a lot With the reference of this I am able to integrate Spring boot with MySQL and Neo4j repositories at the same time.
@saikatkoley59762 жыл бұрын
Excellent, it really helped a lot.
@Roma40862 жыл бұрын
very helpful. thank you for video
@kuldeepsahoo16025 жыл бұрын
Bhai mast heichhi video ta
@gokulaher24763 жыл бұрын
Very nice Explanation.. Requesting you to pl. make a similar 30 minute video including code example for distributed transaction management using Spring Boot microservice. Thanks!
@astbhanmaurya23102 жыл бұрын
Great
@alisheratadjanov37472 жыл бұрын
Thanks. Awesome and helpful
@nagarjunagorantla36294 жыл бұрын
thanks for sharing the valueble info..How to connect with Maria DB and Mssql DB
@Javatechie4 жыл бұрын
Just change datasource properties that's it
@mars42193 жыл бұрын
Thanks a lot, you are the best!!!
@neha60002 жыл бұрын
Best 😘
@priyankawagh52174 жыл бұрын
Excellent!!
@daredevone4 жыл бұрын
Good stuff! It seems like multiple schemas are also accessible with the same datasource only by putting different usernames. Thanks.
@Javatechie4 жыл бұрын
Not by username , you can say schema name
@vihariv38293 жыл бұрын
always your super sir
@abidinberkay12 жыл бұрын
i didn't understand onepoint; there are two entityManagerFactory in 2 db config class. What if we have so many entity classes and repo classes in the project? do we need to create config file for every single model class that we have ?
@Javatechie2 жыл бұрын
No if Entity belongs from same Database then in one entityManager configuration you can add those entity
@chilukabharath48093 жыл бұрын
Nice Video could you please clarify the below points 1. (23:24) in persistanceUnit("Book") we configure for one table entity, what if the db have some 10 tables how to configure all of them 2. And you created Repository by extending Jparepository what if we want to interact with 10 tables in that Db. 3. is there any way to configure EntityManager per datasource so that we can interact with all tables in that datasource? Please explain these points.
@Javatechie3 жыл бұрын
For each table you need to create separate repo that's what database per service pattern in microservices
@chilukabharath48093 жыл бұрын
@@Javatechie ok so i need to create 10 interfaces(Repositories). and is there any way to configure EntityManager per datasource?
@bareetsingh3 жыл бұрын
Thank you, so much.
@narendarreddy31585 жыл бұрын
Nice video basanth.. How @configurationproperties() working here.. because in properties file the prefix is (spring. User........) but in your config class you mentioned pring.user... how the data source were created in your application. Check at time about 12:19 .. nice video..
@Javatechie5 жыл бұрын
Hey Narendra yeah it should be spring ,latter I changed spell before run
@narendarreddy31585 жыл бұрын
@@Javatechie ohh.. Okay
@nageswararaopalchuri30035 жыл бұрын
What is the use of writing the spring.autoconfigure.exclude in properties file
@Javatechie5 жыл бұрын
@@nageswararaopalchuri3003 you can ignore it ,I just used it to disable all the database related auto configuration as I configured manually using java base config approach
@Shafmohaa2 жыл бұрын
Thanks!
@yaminin64873 жыл бұрын
Amazing 🙏
@prasenjitmukherjee36542 жыл бұрын
Mind-blowing. Can you make a tutorial on Mule
@djamelzerrouki52545 жыл бұрын
Thank you for this tutorial I am very happy
@Javatechie5 жыл бұрын
That's what I did here , two database means definitely we need to configure two different datadource . Let me know your doubts with more info
@djamelzerrouki52545 жыл бұрын
@@Javatechie my Question is how you can create a new datasource at runtime by controller web by generated code . " programmatically and dynamic "
@Javatechie5 жыл бұрын
We are manually creating datasource specific to database then we are adding required configuration stuff Once our datasource created we are mapping it to entity manager .
@djamelzerrouki52545 жыл бұрын
@@Javatechie Thanks sir, I know what I did but can you help me do this work? Or guide me something in this problem
@sabyasachimondal044 жыл бұрын
Thanks for the video. Can you please make a video showing Springboot Application which will be deployed to Weblogic Server and connect to a JNDI datasource which is already created in weblogic server. Thanks in advance.
@jeremiahchang84034 жыл бұрын
找了很多教程都不行,这个ok,thanks!
@pratapjavasingh32395 жыл бұрын
Great JOb Basant BHi :)
@tw55294 жыл бұрын
Very nice explanation. Keep it up. Can't we keep both user and book repository interfaces in a single package instead of keeping in 2 different packages??
@Javatechie4 жыл бұрын
No not possible you will get exptception so we should follow the hierarchy
@tw55294 жыл бұрын
@@JavatechieThank You so much for your quick response 😊👍. may I know the reason....why it's not possible?
@reginaldospricigo79554 жыл бұрын
Great! Thanks for sharing.
@profindia3 жыл бұрын
Thanks for this video. One small query, if i have one more entity, say UserAddress, then how would i indicate this in the userconfig class?
@Javatechie3 жыл бұрын
We can setClasses in spring config class only as I can't remember the syntax now .
@ElonMusk-wo7zf Жыл бұрын
Bro. Please do a tutorial on Multi-tenancy in spring boot.
@pncabhsiek33114 жыл бұрын
What about rollback Trx 1 on failure of Trx 2 in two different databases.
@Javatechie4 жыл бұрын
As far I understand we can't apply transaction on database level it should be Table level correct me if am wrong
@pncabhsiek33114 жыл бұрын
Yes it's on table level. But what If I have to achieve a common/ global transaction on two diff tables... Example: a distributed Trx mgmt, if there are two tables(say db1.table1 and db2.table2).. but using single Trx. Like, if amount debited from db1.SBI table is successful. But credit in db2.hdfc table is failed. Then it should rollback. And SBI refund should be there. so if you can demo using Hibernate Jpa and spring boot. It would be great.
@Javatechie4 жыл бұрын
@@pncabhsiek3311 I was also searching this pattarn but didn't succeed yet .I will update you once I do
@7doorshr5982 жыл бұрын
@@Javatechie Hello dear, have you find any valuable information of the @pnc abhsiek question ?
@dhruvarnav86 Жыл бұрын
Hi, Can we join two tables from different databses? Say employee is in oracle DB and Department in mysql DB. I dont want to join inside service but want to join in repo using jpql.
@Javatechie Жыл бұрын
I don't think we can do that but let me try and update you
@LucaDallaVecchia5 жыл бұрын
It works!!!!!!
@LaVerguenzaDeTwitch4 жыл бұрын
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?
@Javatechie4 жыл бұрын
You only need to create additional repository later that's it
@LaVerguenzaDeTwitch4 жыл бұрын
@@Javatechie Nice, this works for me, i love you
@hc59505 жыл бұрын
nice tutorial
@saadmohammed60624 жыл бұрын
I have one doubt? I have two schemas work -> customer_table work2 -> customer_table how can I call dynamically for different schemas? I have one POJO class and one repository, how to change the table name dynamically.
@Javatechie4 жыл бұрын
Is both schema comes under same datasource?
@saadmohammed60624 жыл бұрын
@@Javatechie Yes, But we have to write two resources, such as localhost:8080/work/customer1 and localhost:8080/work/customer2
@Javatechie4 жыл бұрын
@@saadmohammed6062 hi could you please elaborate bit more With this 2 resource what you want to achieve
@saadmohammed60624 жыл бұрын
@@Javatechie I have two schemas in MySQL. work1 and work2 each have a customer table. How to call them dynamically at runtime.
@LolLol-bb5cx4 ай бұрын
Hi, Java Techi, Thank you for your video, I have a doubt I configured just like you with customer and order in two different DB and they are in one to many relation so when I set scan packages to com.example in config I'am able to create table but all tables are getting created in both DB how do I resolve that and make to create only one table in each DB
@malleswarrao3887 Жыл бұрын
Can you please give explanation for distributed transactions in spring microservices
@Javatechie Жыл бұрын
Already i uploaded videos on it . check saga choreography
@pavankumar-si2jv5 жыл бұрын
Do we have to add configuration class for every entity in the project? Lets say there are 10 entity classes?
@Javatechie5 жыл бұрын
Only configuration required for data source not for entity pavan
@pavankumar-si2jv5 жыл бұрын
@@Javatechie You have used persistent Unit name as "User' . So my question was what if there are 10 entitites. ? Should should write configuration for all 10 entities as persistant Unit?
@Javatechie5 жыл бұрын
Pavan in one configuration we can mention multiple entity . this what the small poc .
@saranyanatarajan93409 ай бұрын
Hi sir good explanation, I am having a doubt I need to connect different schemas like user model has separate user schema and book model has separate book schema but both are in sql database , may i use this same configuration for this task and also should i create a separate separate packages for both "pls reply "
@Javatechie9 ай бұрын
Yes you can follow the same only change the schema name in the URL in the application.properties
@ProgrammingRJPT6 ай бұрын
@@Javatechie Is there any way we can pass dynamic schema name rather than hardcoding in application.properties? let's say adding new schema for any new client enrolled to system. Thanks in advance!
@thakunuppathi78935 жыл бұрын
thank you very much ^__________^
@sravanreddymatta53814 жыл бұрын
There you mentioned persistent entity as User And Book. What should I mention of I have more than 5 entities in that model packages.
@Javatechie4 жыл бұрын
Can you explain your complete scenario
@sravanreddymatta53814 жыл бұрын
@@Javatechie what is that persistent()?. There you mentioned entity name. But what about if we have multiple entities. How do I mention entities to that persistent.
@nareshe990611 ай бұрын
hi, you tightly coupled specific model/entity class .If we have more than one table/entity how to configure.?
@prithvikrishna11643 жыл бұрын
Hi @Java Techie Can we Datasource-1 for Multiple repositories? Example: I am having two Data Sources DS-1, DS-2 DS-1 contains Books, NewsPaper, Notes, Ref-Materials, etc tables, Whereas DS-2 contains transactions of users. It's Possible to connect DS-1 with Multiple Repo?
@Javatechie3 жыл бұрын
Yes we can
@prithvikrishna11643 жыл бұрын
@JavaTechie Thanks for the quick reply. If possible can you share any demo projects or video for reference.
@deepakkasturirangan43833 жыл бұрын
Use a separate DB Config for each domains and create separate EntityManagerFactoryBean using EntityManagerFactoryBuilder (as shown @ 15.36)
@Javatechie2 жыл бұрын
Yes it's not straight forward
@kundanranjan37375 жыл бұрын
thanks dear
@jaydeepchauhan4292 жыл бұрын
How to get all suggestions like you did when write classes name...? I am also using Eclips
@VikramKumar-ou3lh2 жыл бұрын
while adding Hikari config I am getting : HikariPool-1 - dataSource or dataSourceClassName or jdbcUrl is required.
@kalaivanisundaram38424 жыл бұрын
Hi, I Need your advice here. I’m building a web application which allows users to choose database (HK,UK,US) from the UI. Based on his selection of databases, I need to connect to respective DB instance in the spring boot + Jpa. Please share your thoughts!
@Javatechie4 жыл бұрын
We can do one thing Based on UI input we will enable profile for region rather than environment Let's se I chooses UK then from application we will setActiveprofile to UK so that corresponding datasource properties will be loaded . Do let me know if you have any issue. Very interesting concept
@veenatiwari47943 жыл бұрын
Thanks for this wonderful video..it's so helpful.. Awesome way of explaining.. thanks for your efforts for us learners... Sir I have one question... without @Entity class we can connect to data base..as I need to fire queries..having different table...how I can do that.. please suggest.. I don't want to create table in db ..but want to retrieve data from different table...in case..I don't need that that Entity class created..I made dto..to fetch the data....but..how I can do..can you please suggest
@veenatiwari47943 жыл бұрын
How I can connect to multiple database without..@Entity class creation..as we don't need any creations
@Javatechie3 жыл бұрын
Thanks man , Need to check this
@veenatiwari47943 жыл бұрын
@@Javatechie thanks sir..heads up to your efforts
@dinobulja2 жыл бұрын
How about using different database vendors? How would you set then multiple data bases? And database dialects?
@skipa99062 жыл бұрын
Hi. how can I Sync the two databases? when database A is updated then Database B gets automatically updated?
@Javatechie2 жыл бұрын
Not sure will check and update
@skipa99062 жыл бұрын
@@Javatechie that would be gladly appreciated, thank you.
@shridharabm57934 жыл бұрын
hi sir, its more informative can u please share us for same as for NO SQL databases
@Javatechie4 жыл бұрын
I don't think we need datasource configuration for NoSQL DB But I will show one demo with multiple NoSQL config in single application
@shridharabm57934 жыл бұрын
@@Javatechie thanks for your response....
@Shafmohaa2 жыл бұрын
I have 2 schemas, and both are identical (they are just replicas), do I still need to maintain 2 different models and repositories? Or can the basePackages be the same?
@hanumanthram675411 ай бұрын
Getting error: Parameter 0 of method studentEntityManagerFactory in com.school.config.StudentsDataSourceConfig required a bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' that could not be found. Action: Consider defining a bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' in your configuration.
@pavithraakp20674 ай бұрын
Hello Basant, how do we connect more than one table ? could you please answer my question
@tarikhamlat60245 жыл бұрын
Thank you for this video, but how i can use three data source ? the anotation @Primary don't work if we have three data source
@Javatechie5 жыл бұрын
Hi Tarik , thank you Yes it will work with N number of DB , but at same time I don't think we can use it
@OdiaMadBiker4 жыл бұрын
These are only fr specific 2 domain class user and book..if in case we need to use multiple domain class...then how can we maintain in package basis
@MuhammadKhan-vb8jl4 жыл бұрын
we have created two data sources each data source has one table, what if we have more tables in each data source, how we create entities and how we bind to particular data source?
@akshaysachdeva64015 жыл бұрын
Hi, really nice video. Is this also the way to achieve dynamic data source routing? If in the payload we getting which database we require to query/update. Will this be an optimum way to do it?
@Javatechie5 жыл бұрын
Akshya that's why we created two repository right ? Based on your payload choose the appropriate repository and populate the data
@akashrathor98632 жыл бұрын
If I have 100+ tables in both the DB's then I have to make 100+ config classes for both DB ? Is there any smart way of doing this ?
@Javatechie2 жыл бұрын
Configuration not required for table it need for database
@otshudiakoy20124 жыл бұрын
very good! how about synchronisation between remote database and local db?
@Javatechie4 жыл бұрын
Hi John , didn't get you
@otshudiakoy20124 жыл бұрын
@@Javatechie if i have a remote database and the same database is on localhost how to synchronise data between the remote and locahost!
@Javatechie4 жыл бұрын
@@otshudiakoy2012 am not sure but yes I did something like below Take DB dump of your remote DB then import it in your local or just point your local DB to remote host . So that both info can be on sync
@otshudiakoy20124 жыл бұрын
@@Javatechie thanks you!
@noumaanmohammad12743 жыл бұрын
Nice video ... Can we able to join two entities from different datasources and fetching selected columns from both the entities ? is it possible ? Eg : joining User with Book with foreign key and fetching username,bookname after joining.
@Javatechie3 жыл бұрын
This is not valid scenario at all because wrong design
@noumaanmohammad12743 жыл бұрын
@@Javatechie ..sorry , i meant for different schemas in oracle from the same databse... is it possible ?
@Javatechie3 жыл бұрын
Yes absolutely possible , you can just follow this approach also please refer my onetomany association mapping tutorial
@noumaanmohammad12743 жыл бұрын
@@Javatechie Thank you ❤️ .
@anil20094 жыл бұрын
Lombok is not working in my Eclipse ide although I have mentioned in dependencies sir. could you please tell me what may be the problem
@Javatechie4 жыл бұрын
You need to configure it in your IDE , adding dependency is not enough Please go through my blog and search you will get steps to configure Lombok
@hiteshupreti42503 жыл бұрын
Why separate config for each entity ... can't it be done on single config class .. as in real time we will be having multiple entities so i don't think it's good practise to create separate config for each entity. Any suggestion on that
@Javatechie3 жыл бұрын
As there is two datasource we need to configure that in different config . As one of them we are making primary
@hiteshupreti42503 жыл бұрын
So can't we configure more than 1 datasources in 1 config file only ... that's my question
@Javatechie3 жыл бұрын
No we can't Hitesh
@isurumw6119 Жыл бұрын
I have multiple entities in the same package. What should I do?
@nishantlakhapati87253 жыл бұрын
I'm facing an exception. EnitityExistException. Please help
@Javatechie3 жыл бұрын
What you are trying please mention here
@obsessed3943 жыл бұрын
Can we do Master slave data source configuration similar way for one is for write and other is for read
@zamundaking81085 жыл бұрын
Great Tutorial!!
@Jesus-theWay-theTruth-theLife2 жыл бұрын
I am getting error executing ddl "alter table" via JDBC statement
@moajjamali63694 жыл бұрын
Cooolll
@tw55293 жыл бұрын
It's really helpful . I created a sample project. While I am trying to run the app, I am getting below mentioned exception. Please help Parameter 0 of method entityManagerFactory in com.stand.work.config.CompanyDBConfig required a bean of type 'org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder' that could not be found.
@deepakkasgar59543 жыл бұрын
Hi, I have downloaded the code from git and tried to execute. Its creating both the tables in one schema only. Any idea why so? I also have to add few properties in POM.xml to make it work
@anveshkasarla84562 жыл бұрын
Can we migrate data from mysql to psql or psql to mysql.
@Javatechie2 жыл бұрын
Ofcourse we can
@sathishKumar-ft2ij3 жыл бұрын
Hi, i am also using the same context. could you let me know how shall i handle the exception if any one of the db is down or table not exist?
@ilykna23962 жыл бұрын
How to add schema dynamically to DataSourceBuilder ??
@ajaydhiman23683 жыл бұрын
I'm getting lots of exceptions - dependencies are missing. can you share the POM.xml for this application.
@Javatechie3 жыл бұрын
GitHub link mentioned in video description
@vishnumurali5224 жыл бұрын
What is the persistence unit and if I have 20 model class in package Can I work like this?
@Javatechie4 жыл бұрын
Yes you can no issues on that
@vishnumurali5224 жыл бұрын
U give input like user and book to the value of the persistence unit So is it means name of the model class If it is yes how can I give all model for that..
@Javatechie4 жыл бұрын
Dude please watch from begin I mentioned there as I don't have multiple databases install in my machine am giving example using two different entity Let's say I have Oracle and MySQL Oracle db I can configure N number of entity similarly for Oracle I can configure N number of entity Because in one database we xan have multiple entity If you have multiple DB in your machine then please try configure it and see I Just configure 2 schema to show demo how to configure in case data source .
@bsagar74404 жыл бұрын
Can any one help .if i want create multiple table at time in multiple data source. then i how to use persistUnit.
@Javatechie4 жыл бұрын
Raj I will check and update
@rohitkumarsah773 жыл бұрын
Suppose there are two entities for a database and two entities for another...how to cater that
@malleswarrao3887 Жыл бұрын
Facing an issue unsatisfiedcondision error bean for Repository
@tahirkhalifa1233 жыл бұрын
great tutorial but where the oracle configration
@kopparahema14584 жыл бұрын
Hi ... Thank you .. I have went through all your videos related to the H2 and multiple datasources, as I'm building my spring boot objects based on that. But in my spring-boot application I'm using multiple datasource , one is Oracle and other one is H2 database. My application is connecting to Oracle Database, but h2-console is not opening. do you suggest any solution for it. Here is my application.properties file looks like. #oracle spring.oracle.datasource.jdbcurl= spring.oracle.datasource.username= spring.oracle.datasource.password= spring.oracle.datasource.driver-class-name= #H2 spring.h2im.console.enabled=true spring.h2im.console.path= /h2-console spring.h2im.datasource.platform= h2 spring.h2im.datasource.jdbcurl= jdbc:h2:./test spring.h2im.datasource.username= sa spring.h2im.datasource.password= spring.h2im.datasource.driver-class-name=org.h2.Driver
@Javatechie4 жыл бұрын
Remove all property related to H2 from properties file Only add spring.h2.console.enable=true