Changing the type of an entity preserving its ID

前端 未结 5 1656
刺人心
刺人心 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:13

    How do you distinguish between the two entities in the table? I assume that there some field value (or values) that you can change to make B into a C?

    You could have a method where you load the super-class A and change the distinguishing values and save. Then in your next Hibernate Session your B will be a C.

提交回复
热议问题