I receive following error when I save the object using Hibernate
object references an unsaved transient instance - save the transient instance before flushi
I was facing the same error for all PUT HTTP transactions, after introducing optimistic locking (@Version)
At the time of updating an entity it is mandatory to send id and version of that entity. If any of the entity fields are related to other entities then for that field also we should provide id and version values, without that the JPA try to persist that related entity first as a new entity
Example: we have two entities --> Vehicle(id,Car,version) ; Car(id, version, brand); to update/persist Vehicle entity make sure the Car field in vehicle entity has id and version fields provided