I am using Hibernate to persist in the database, and in a given case, for every update that a given Consultor
ed entity has, it should update in the main table called TB_Consultor
and insert a new line in the TB_ConsultorHistorico
table.
The structure of the TB_Consultor
and TB_ConsultorHistorico
tables are identical, and thus,
what I'm avoiding is having to map an entity Consultor
and another ConsultorHistorico
that will be identical, and do everything with one entity.
Is it possible to map with Hibernate for the same entity to write to two tables in the database? Being that in one there will be insertions and updates, and in the other, only insertions.