Right now we have a JPA entity
defined as:
@Entity
@Table(name="Foo")
public class Foo extends ParentClass {
...
}
Imagine that some Foo
objects have been persisted in the database already. What would be the best way to programmatically change those persisted records to a sibling subclass of type Bar
?
@Entity
@Table(name="Bar")
public class Bar extends ParentClass {
...
}
We do not want to change the database schema, just the entity type of the already persisted Foo
objects. I am hoping there is a better method than the only one I have thought of, which is manually grabbing the Foo
objects, remapping to Bar
, and re-persisting.