In Hibernate table per concrete class strategy when fetched with super class following query is generated:
SELECT vehicle0_.VEHICLE_ID AS VEHICLE_ID1_2_,
vehicle0_.MANUFACTURER AS MANUFACTURER2_2_,
vehicle0_.PASSENGER_CAPACITY AS PASSENGER_CAPACITY1_0_,
vehicle0_.LOAD_CAPACITY AS LOAD_CAPACITY1_1_,
vehicle0_.clazz_ AS clazz_
FROM
(SELECT VEHICLE_ID,
MANUFACTURER,
PASSENGER_CAPACITY,
NULL AS LOAD_CAPACITY,
1 AS clazz_
FROM PassengerVehicle
UNION ALL
SELECT VEHICLE_ID,
MANUFACTURER,
NULL AS PASSENGER_CAPACITY,
LOAD_CAPACITY,
2 AS clazz_
FROM TransportationVehicle
) vehicle0_
vehicle0_.clazz_ is selected in query which is not there in table nor in class, what is this clazz_ attribute?
That's inheritance discriminator.
When you joined your subclass with super class, do avoid the confusion while instantiating from the result set, hibernate internally uses the column 'clazz'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With