How to change Entity type in JPA?

前端 未结 5 977
终归单人心
终归单人心 2020-12-09 20:25

In my specific case, I am making use of a discriminator column strategy. This means that my JPA implementation (Hibernate) creates a users table with a special

5条回答
  •  感情败类
    2020-12-09 21:11

    When you say conversion you probably misrepresent the problem. What you really is trying to do in my opinion is to construct instance of one class based on an instance of the other class, for example:

    public PayingUser(TrialUser theUser) {
    ...
    }
    

    Then you can delete old trial user and persist new paying user.

提交回复
热议问题