Hello I’m using xml files and I have a superclass A that have a relation with another class C. The class A doesn´t have a table because all the data is storage in the subclasses. But I need to do a reference to the Id of the class A in the table of the class C. I don´t know if that is possible thought, if it´s posibly how can I do it?
First, which one is A and C in your diagram?
Class A needs to be a @MappedSuperclass
. The old HBM mappings are deprecated, so I’ll give you the solution with annotations, which you can translate it to HBM later.
But I need to do a reference to the Id of the class A in the table of the class C
Since A has no table, it cannot have an ID.
So, if A is @MappedSuperclass
, Tarifa
can be the base class using @Inheritance(strategy = InheritanceType.JOINED)
and the subclasses can have their own separate tables.
For more details, check out this article too.
Thank you i have already change it to joined because I need the superclass to have an Id.