Ok, but how it can help if next_val will be greater than 2 or I will try to run this code on another DB instance where next_val is already initialized? Please note that my test case works fine with hibernate 5.6.3.Final