I have 2 object person and address. person is parent and address is child.

* Person : personPK , status
* Address : addressPK , person\_fk, status

My repository is extending JPARepository.
`personRepository.save(person);`
is working fine for insert.
But when I update the person object by updating status(eg: Active) in both the tables and use `personRepository.save(person);` My foreign key references(person\_fk) is set as null.

My parent class :

```
@Entity
@DynamicUpdate
@Table(name = "person")
public class Person {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="person_pk", nullable=false)
    private Long personPK;
    @OneToMany(fetch = FetchType.EAGER, mappedBy = "person",cascade = CascadeType.PERSIST)
    private Set<Address> addresses = new HashSet<>();
    ...
}

```

And my child class :

```
@Entity
@DynamicUpdate
@Table(name = "address")
public class Address {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "address_pk")
    private Long addressPK;
    @ManyToOne
    @JoinColumn(name = "person_fk", referencedColumnName = "person_pk", nullable=false)
    private Address address;
    ...
}

```

And from my service layer I am updating it using :
`personRepostiry.save(person);`

Any help what I am doing wrong here?