jpa Table per concrete class inheritance strategy

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Remarks

  • Vehicle, TransportationVehicle and PassengerVehicle are abstract classes and they will not have separate table in database.
  • Truck, Car and Bike are concrete classes so they will be mapped to corresponding tables. These tables should include all the fields for classes annotated with @MappedSuperClass because they don’t have corresponding tables in database.
  • So, Truck table will have columns to store fields inherited from TransportationVehicle and Vehicle.
  • Similarly, Car and Bike will have columns to store fields inherited from PassengerVehicle and Vehicle.

Full example can be found here



Got any jpa Question?