I have been reading a lot about @JoinColumn but I still don\'t get the idea behind it.
Patient Table
CREATE TABLE patient (
patient_id BIGINT NOT NUL
Why is that the
patient_id
(generated column which is a FK) in the Vehicle Table doesn't have any value when I run my code?
All @JoinColumn
does is to specify a column for joining an entity association or element collection. Since you have made @JoinColumn
associated with Patient class object, that's why foreign key is created on Patient table.
For more please refer https://docs.jboss.org/hibernate/jpa/2.1/api/javax/persistence/JoinColumn.html