From the course: Java Persistence with JPA and Hibernate
Dependencies - JPA Tutorial
From the course: Java Persistence with JPA and Hibernate
Dependencies
- [Instructor] You might be thinking that there's a whole bunch of dependencies to be able to work with Jakarta Persistence and Hibernate in your Java application. Well, not so. There's just a couple of dependencies that you'll ever need to work with Jakarta Persistence and Hibernate. In fact, it's simply two dependencies, the hibernate-core dependency and the mariadb-java-client dependency. No matter if your application is a Java standalone application or an Enterprise application, you just need these two dependencies to get Hibernate up and running. The hibernate-core dependency is a library that contains everything you need to work with Java Persistence using the ORM framework Hibernate. And what is mariadb-java-client? Well, it contains the JDBC driver implementation for the DBMS, which in this case is MariaDB. As you know, in order to connect to a database, Java uses Java database connectivity, JDBC. JDBC is just a specification and different vendors like MariaDB, MySQL, and etc. provide their own implementation specifying how a Java application could connect to their respective database. This implementation is the JDBC driver. No matter what ORM framework we use, it has to establish the connection with the underlying vendor database via JDBC. This is why we need the relevant JDBC driver for the DBMS that we are using. So in this case, it is MariaDB and therefore we use the mariadb-java-client, which is the JDBC driver. I'm in my code space. For this video, you should be in the branch for this video, which is 02_03. If you are in the main branch, you can switch to 02_03 branch by clicking on the branch name main in the bottom status bar, and from the dropdown that appears at the top, you can select 02_03. This is a standalone Java application that you have here, and it's a Maven Java application. Click on pom.xml in the explorer. The dependencies are empty right now. Let's specify the two required dependencies for this project. In your browser, open mvnrepository.com. You can search for the Hibernate-core Maven dependency. Here it is. Go for the latest table version that's available and copy it. Then paste it within the dependencies tag. Let's get rid of this. Back again in the Maven repository page, search for MariaDB JDBC driver. Here it is. Let's go ahead and copy the latest table version available and paste it under dependencies as well. Let's get rid of this again. Now you have everything needed to get started on working with Jakarta Persistence and Hibernate in your Java application.