Changing the type of an entity preserving its ID

前端 未结 5 1677
刺人心
刺人心 2020-12-31 11:07

I am using hibernate as a persistence layer. There are 2 entities that live in the same table extending one superclass with single table inheritance strategy.



        
5条回答
  •  春和景丽
    2020-12-31 11:11

    I think skaffman is right here, once the id has been set it won't persist, and further because the id is generated it expects the sequence to be in charge of assigning the id number.

    You could possibly not put the id as @GeneratedValue? or one of the different generator strategy types maybe to avoid the merge generating a new sequence value, but I suspect that would be problematic.

提交回复
热议问题