I use Java Persistence versioning in Spring Boot project for handling optimistic concurrency control.
I have 3 model: Process, Amazing and Contract.
Process
@Entity
@Table(name = "processes")
class Process(
...
...
@Version
private var version: Int = 0
)
Amazing
@Entity
@Table(name = "amazing")
class Amazing(
@JsonIgnore
@ManyToOne
@JoinColumn(name = "process_id")
var process: Process
...
...
)
Contract
@Entity
@Table(name = "Contracts")
class Contract(
@JsonIgnore
@ManyToOne
@JoinColumn(name = "process_id")
var process: Process
...
...
)
Now I want retrieve data from database. First, I call process, then call list of amazing and contracts. The problem is when I call second list, version of process is incremented!
val process = processRepo.findById(processId) //version is 20
val contracts = contractRepo.findAll() //version is 20
val amazing = amazingRepo.findAll() //version is 21
ContractRepo
interface ContractRepo : JpaRepository<Contract, Long>
AmazingRepo
interface AmazingRepo : JpaRepository<Amazing, Long>
I cannot find the problem why version is incremented in second call without save process?
Notice:
I enable SQL log. All that is logged are selects.
Hibernate: select fixedamazi0_.id as id1_8_, fixedamazi0_.action_date as action_d2_8_, fixedamazi0_.amount as amount3_8_, fixedamazi0_.created_at as created_4_8_, fixedamazi0_.employee_id as employee9_8_, fixedamazi0_.expiration_date as expirati5_8_, fixedamazi0_.modified_at as modified6_8_, fixedamazi0_.percent as percent7_8_, fixedamazi0_.process_id as process10_8_, fixedamazi0_.row_code as row_code8_8_ from fixed_amazing fixedamazi0_
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select payrollpro0_.id as id1_19_0_, payrollpro0_.comments as comments2_19_0_, payrollpro0_.company_id as company_8_19_0_, payrollpro0_.created_at as created_3_19_0_, payrollpro0_.modified_at as modified4_19_0_, payrollpro0_.period_id as period_i9_19_0_, payrollpro0_.state as state5_19_0_, payrollpro0_.type as type6_19_0_, payrollpro0_.version as version7_19_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, payperiod3_.id as id1_15_3_, payperiod3_.code as code2_15_3_, payperiod3_.created_at as created_3_15_3_, payperiod3_.days_count as days_cou4_15_3_, payperiod3_.end_date as end_date5_15_3_, payperiod3_.modified_at as modified6_15_3_, payperiod3_.name as name7_15_3_, payperiod3_.persian_end_date as persian_8_15_3_, payperiod3_.persian_start_date as persian_9_15_3_, payperiod3_.start_date as start_d10_15_3_ from payroll_process_managements payrollpro0_ left outer join companies company1_ on payrollpro0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join pay_periods payperiod3_ on payrollpro0_.period_id=payperiod3_.id where payrollpro0_.id=?
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select employee0_.id as id1_7_0_, employee0_.company_id as company_9_7_0_, employee0_.created_at as created_2_7_0_, employee0_.isargari_type as isargari3_7_0_, employee0_.modified_at as modified4_7_0_, employee0_.personnel_id as personne5_7_0_, employee0_.roles as roles6_7_0_, employee0_.status as status7_7_0_, employee0_.type as type8_7_0_, employee0_.user_id as user_id10_7_0_, company1_.id as id1_2_1_, company1_.areas as areas2_2_1_, company1_.company_code as company_3_2_1_, company1_.created_at as created_4_2_1_, company1_.direction as directio5_2_1_, company1_.financial_code as financia6_2_1_, company1_.modified_at as modified7_2_1_, company1_.name as name8_2_1_, company1_.parent_id as parent_11_2_1_, company1_.province as province9_2_1_, company1_.zone as zone10_2_1_, company2_.id as id1_2_2_, company2_.areas as areas2_2_2_, company2_.company_code as company_3_2_2_, company2_.created_at as created_4_2_2_, company2_.direction as directio5_2_2_, company2_.financial_code as financia6_2_2_, company2_.modified_at as modified7_2_2_, company2_.name as name8_2_2_, company2_.parent_id as parent_11_2_2_, company2_.province as province9_2_2_, company2_.zone as zone10_2_2_, user3_.id as id1_24_3_, user3_.birth_date as birth_da2_24_3_, user3_.created_at as created_3_24_3_, user3_.email as email4_24_3_, user3_.father_name as father_n5_24_3_, user3_.first_name as first_na6_24_3_, user3_.gender as gender7_24_3_, user3_.isargari_type as isargari8_24_3_, user3_.last_name as last_nam9_24_3_, user3_.marital_state as marital10_24_3_, user3_.modified_at as modifie11_24_3_, user3_.national_code as nationa12_24_3_, user3_.password as passwor13_24_3_, user3_.personnel_id as personn14_24_3_, user3_.phone as phone15_24_3_, user3_.sso_validation as sso_val16_24_3_, user3_.telephone as telepho17_24_3_, user3_.version as version18_24_3_ from employees employee0_ left outer join companies company1_ on employee0_.company_id=company1_.id left outer join companies company2_ on company1_.parent_id=company2_.id left outer join users user3_ on employee0_.user_id=user3_.id where employee0_.id=?
Hibernate: select maincontra0_.id as id1_10_, maincontra0_.action_date as action_d2_10_, maincontra0_.base as base3_10_, maincontra0_.created_at as created_4_10_, maincontra0_.employee_id as employee7_10_, maincontra0_.expiration_date as expirati5_10_, maincontra0_.modified_at as modified6_10_, maincontra0_.process_id as process_8_10_ from main_contracts maincontra0_
You don't need explicitly save entity if said entity in first level cache.
I suspect you change some attribute of
Process
, when you callamazingRepo.findAll()
it cause flush ofAmazing
and all entities it depend on (which includesProcess
).