1

Topic: Hibernate AND Optimistic Lock

Faced a problem: the Data is loaded in the table (Vaadin). Further they can be edited and saved. After the second saving the error falls: the field version does not coincide. It was clarified that after a call save at JpaRepository the new is returned!!! Object, at which correct version. It turns out that it is necessary to replace with this new object in the table old object? Somehow it is possible to get rid of it?

2

Re: Hibernate AND Optimistic Lock

Hello, lamer2001, you wrote: L> It was clarified that after a call save at JpaRepository the new is returned!!! Object, at which correct version. L> It turns out that it is necessary to replace with this new object in the table old object? At least the version old should be updated. Better certainly to replace if it is possible. L> Somehow it is possible to get rid of it? From what it? From new object? Short (and correct) the answer - is not present. If you save object which not from current session that on id  loads new of basis, copies there the data and saves in . From what the decision - to hold session opened together with your table, but to do so it is not necessary.

3

Re: Hibernate AND Optimistic Lock

Hello, lamer2001, you wrote: L> the Data is loaded in the table (Vaadin). Further they can be edited and saved. After the second saving the error falls: the field version does not coincide. L> It was clarified that after a call save at JpaRepository the new is returned!!! Object, at which correct version. L> It turns out that it is necessary to replace with this new object in the table old object? Yes, quite right. L> Somehow it is possible to get rid of it?  tables, differently in any way.