Java – is there a way to disable hibernate optimistic locking?
•
Java
I have one entity:
@Entity public class VersionedDo { @Version @Column(name = "version") private int version; ... }
I want to update this entity without adding a version in some cases There is no direct SQL update. Is there a way to do this?
Solution
From hibernate documentation:
So with hibernate, I guess you can't force the version field to keep its original value when updated You can only do the opposite
You will have to use classic SQL queries, and don't forget to "Refresh" your hibernate objects if necessary
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码