Org.springframework.orm.objectoptimisticlockingfailureexception во время сохранения в KotlinJAVA

Программисты JAVA общаются здесь
Anonymous
Org.springframework.orm.objectoptimisticlockingfailureexception во время сохранения в Kotlin

Сообщение Anonymous »

, пытаясь сохранить сущность, я получаю следующее исключение < /p>

Код: Выделить всё

org.springframework.orm.ObjectOptimisticLockingFailureException: Row was updated or deleted by another transaction
< /code>
Это моя сущность, и у меня нет поля версии, и мы не можем добавить его < /p>
@Entity
@Table(name = "customer")
class Customer (

@Id
@GeneratedValue
@Column(name = "uuid", updatable = false)
val uuid: UUID,

@Column(name = "first_name", nullable = false)
var firstName: String
)
< /code>
И я создаю объект объекта, подобный этому < /p>
return Customer(
uuid = UUID.randomUUID(),
firstName = validatedCreationRequest.firstName?.value?: "",
)
< /code>
val createdCustomer = customerRepository.save(Object)
< /code>
Starting hibernate 6.6 their were come changes but which says not to set the @id field but how to set the UUID to null, should i make it null able ? UUID?


Подробнее здесь: https://stackoverflow.com/questions/795 ... -saving-in

Вернуться в «JAVA»