Kotlin copy() function is creating a new Id on a JPA Entity resulting in a new row
I have an update method on a spring controller which takes in a request and uses copy to copy the contents into a loaded entity. As soon as copy() is called, the id property on the entity is changed to a new one.
@PutMapping("/{id}")
fun update(@PathVariable id: UUID, @RequestBody request: UpdateSocietyRequest): ResponseEntity {
val society = societyRepository.findById(id).orElse(null) ?: return notFound().build()
val updatedSociety = society.copy(
name =...