From the course: Java Persistence with JPA and Hibernate
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Solution: Art Class Management app, part 2 - JPA Tutorial
From the course: Java Persistence with JPA and Hibernate
Solution: Art Class Management app, part 2
(upbeat digital music) - [Teacher] Here's my solution to this challenge. I've defined the four entity classes, art class, teacher, student, and review, inside a package named Entities under the @folder. Then, I've annotated all of them with the @Entity annotation. You will also need to annotate all the classes with the @Table annotation, because the table names are not the same, or identical to the class names. Next, I map the entity classes to table columns using the @Column annotation. This has been done in all the classes. Make sure you use the @Column annotation on all things that are not identical to the column names in the tables. Next, I've defined the primary key of each entity class. The primary key should be a generated value, so it has been defined with the generation strategy of identity. Once again, the primary keys should be defined in all the entity classes. In the main class, I've written code to perform the create operation on the student entity to insert the student…
Contents
-
-
-
-
-
-
Defining an entity3m 59s
-
(Locked)
Mapping entity fields to table columns3m 57s
-
(Locked)
Specifying the primary key4m 57s
-
(Locked)
Creating a new entity instance in the context5m 39s
-
(Locked)
Challenge: Art Class Management app, part 21m 10s
-
(Locked)
Solution: Art Class Management app, part 22m 27s
-
-
-
-
-
-