I have two tables, that share the same definition. I commonly insert new objects into one of these tables, let's call it Table1. From time to time, I want to move one entry from Table1 to the other table (Table2).
How can I achieve this using the OpenJPA Framework? The object is clearly bound to one table ...
@Entity
@Table(name="TRACKING")
public class TrackingEntry {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
@Column(name="LASTNAME")
private String lastName;
@Column(name="FIRSTNAME")
private String firstName;
// rest omitted
}
Any Ideas besides using an "on delete" trigger on database level? (I'd like to hold this logic in code only).