From the course: Java Persistence with JPA and Hibernate
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Solution: Art Class Management app, part 1 - JPA Tutorial
From the course: Java Persistence with JPA and Hibernate
Solution: Art Class Management app, part 1
(upbeat music plays) - [Instructor] Here's my solution to this challenge. In the persistence.xml file, I set the persistence unit name to artclass_persistence_unit and also set the database name to art class in the JDBC URL property. This is all that you'll need to do in the persistence.xml file. Then in the Main.java class in the Main method, first I created the EntityManagerFactory using the persistence unit name, artclass_persistence_unit, in line nine. Next, I created an EntityManager using the EntityManagerFactory by calling the createEntityManager method on the EntityManagerFactory. That is line number 11 in this code. That's all you've got to do. Now you can run the Main class, but before you run, make sure that the artclass database exists. If not, be sure to first set up the database by running the scripts in mariadb init.sql file, and then run the Main class. All right, there are no errors. You've successfully bootstrapped Jakarta persistence and hibernate in your own…
Contents
-
-
-
-
-
Entities and the persistence context5m 9s
-
(Locked)
EntityManager interface4m 55s
-
(Locked)
Bootstrapping JPA and Hibernate: Creating the configuration5m 56s
-
(Locked)
Bootstrapping JPA and Hibernate: Creating the EntityManager3m 33s
-
(Locked)
Challenge: Art Class Management app, part 11m 30s
-
(Locked)
Solution: Art Class Management app, part 11m 43s
-
-
-
-
-
-
-