hibernate - Binding actual column name inside of the child class: possible? -
i have several table sharing n columns, think best strategy making abstract class inheritancetype=table_per_class. problem that, though columns same, go different name.
for example:
t1 --name varchar(100) --surname varchar(50) t2 --person_name varchar(100) --person_surname varchar(100)
columns same, type same..but name different! so, there way define abstract parent class:
@entity @inheritance(strategy = inheritancetype.table_per_class) public class parent{ private string name; private string surname; }
and then, inside of children entities, specify actual column name?
what need add following child entity:
@attributeoverrides({ @attributeoverride(name="name", column=@column(name="person_name")), @attributeoverride(name="surname", column=@column(name="person_surname")) })
Comments
Post a Comment