I have 2 customer tables and customerhistory. customhistory has a foreign key customerId, which refers to the customer customerId. In the Entity that the JPA generated, I have a customer object in the customerhistory class, whereas I want to save only customerId in the customerhistory table
I get the correct customerId, but when I want to keep the customerId attribute, I only have the customer object with me, but there is no customerId in the class of auto-generated consumerhistory objects
@Entity public class Customerhistory implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private int primarykeyId;
As shown above, I do not have clientId with me in the customerHistory entity. How to save it?
curious
source share