Closed agdt3 closed 6 months ago
Addendum: simply having a version column, even without the annotation, triggers the same effect. e.g.
@Column
private Integer version;
Any SQL interaction is subject to Hibernate, Spring Data merely uses EntityManager
method calls to persist objects, any database interaction is handled by Hibernate.
@mp911de Apologies for misfiling.
Perhaps its related to this: https://hibernate.atlassian.net/browse/HHH-18175 https://github.com/hibernate/hibernate-orm/pull/8468
Hi all,
Ran into a potential issue that's breaking a lot of my code, but not 100% sure if its a new issue. Basically, if you have a
@Version
column on a child or related entity, that entity will be rolled back if its in some way related to parent.Example code:
Entities:
Repositories:
Service:
DB In the DB, the version column is defined as int, nullable=true, no default value.
The basic issue here is if you leave the
@Version
columns in, you get the following DB process (no errors thrown by spring data jpa):If you remove the
@Version
columns, you get just normal inserts:Things I have tried that did not work:
@Transactional
method (in a separate service)Things that did work:
@Version
columnspom.xml:
application.yml