How to create (Oracle,Other)SQL DB configuration using spring and maven

Objective:

In my previous blog, I explained and demonstration NoSQL DB configuration and this blog is to give an insight to create the relational SQL  DB configuration using spring and maven with proper transaction manager and entity manager factory configuration

Pre-requisite:

To create Oracle/any SQL configuration, following are required.

  • Running Oracle/any SQL DB, could be protected by user name and password
  • Maven dependencies

Maven Dependency

To create configuration following dependencies are required.

Here, I chose Oracle as SQL DB therefore I used oracle jdbc driver. If you want to use other SQL DB then add DB specific driver dependency.

Add database information into this file as given below:

OracleDB/any SQL Configuration:

To create the configuration, I used @EnabledJpaRepositories and @EnableTransactionManager annotation to link oracle/sql DB with spring.

EnabledJpaRepositories is used to load all the repositories of the application and attach with a entitymanangerfactory and transactionManager. Without these two( EntityManagerFactory and Transaction Manager) configuration won’t get connect with DB and unable to start the spring app with dependency failure exception.

The EntityManagerFactory reference  scans all the present DB entities in the application. To scan all the entities, I have created a marker interface in Entities’s package.

 

To load all the repository classes I have added a marker interface in repository folder where all the repository present.

Now, this configuration has integrated with spring using spaing, JDBC driver, JPA and hibernate.
If you face any difficulty to configure then leave a comment to help you out.

Git Source:

Click here for complete source code

share or like this post
Share

8 thoughts on “How to create (Oracle,Other)SQL DB configuration using spring and maven

  1. 91Rigoberto

    I must say you have high quality articles here.

    Your blog should go viral. You need initial traffic only.
    How to get it? Search for: Miftolo’s tools go viral

  2. education degree

    Thanks on your marvelous posting! I genuinely enjoyed reading it, you will be a great author. I will make sure to bookmark your blog and may come back in the foreseeable future. I want to encourage one to continue your great posts, have a nice evening!
    https://edutips.eu

  3. business finance

    First off I would like to say great blog! I had a quick question that I’d like to ask if you don’t mind. I was interested to find out how you center yourself and clear your head before writing. I have had difficulty clearing my thoughts in getting my thoughts out. I do take pleasure in writing but it just seems like the first 10 to 15 minutes are usually wasted just trying to figure out how to begin. Any suggestions or hints? Kudos!

  4. finance and business

    Good day! This is my 1st comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading through your blog posts. Can you recommend any other blogs/websites/forums that cover the same subjects? Thanks for your time!|

Leave a Reply to education degree Cancel reply

Your email address will not be published. Required fields are marked *

Share