Your problem scenario is of Inheritance Mapping. The Id field is there in your super class but what about your child class, how they will be related to their parent.
There are different strategy to map an Inheritance hierarchy.
- Using Discriminator value (Single Table)
- Table per concrete class
- Table per Child class (if parent is an abstract)
I think you are missing annotations related to above.
In Discriminator based approach.. You need to annotate your ParentClass as follows:
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="type",discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue(value="ParentClass")
And in you child class:
@DiscriminatorValue("childClasss")
Please refer some tutorial on Inheritance Mapping like this one or you can google it.