Java Persistence - Module 1 - Basic Mapping – Practice
-
Prepare a new project with JPA inside. Call it CarManagement.
-
Create entity Car with the following fields: Long id, String model, Integer power.
-
Create embeddable value type Engine with the following fields: String model, Integer volume.
Include it to the Car entity.
-
Test basic read-write operations with the Car entity.
-
Add new fields to the Car and Engine classes at your discretion. Try to use following annotations:
b. SecondaryTable
e. Enumeration (for example create CarType enum)
f. Convert (create some Converter)
- Create the following successors for the Car class: ElectricCar, OilCar, and HybridCar. Add some
specific fields for them. Try to use all three types of inheritance mapping.
-
[Optional] Try to use both MySQL and PostgreSQL databases and both Hibernate and EclipseLink
-
[Optional] Connect the object model and the tables via pure JDBC. The connection means simple
CRUD operations.