Is there a way to update a part of a composite key. Every time I try, JPA creates a new record in the database.
@Embeddable
public class primaryKey implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private Entity1 key1;
private Entity2 key2;
I am trying to update the key2.
Here is how I am updating:
EntityWithCompositeKey ent = findBy... //This returns only 1 result
ent.setKey2(Entity2 newKey2);
repository.save(ent);