0

I'm upgrading from Spring 4.3.23.RELEASE to Spring 5.3.20 and running into issues with the save and flush of the record due to that Spring is not using the correct next available key value from the Oracle SEQUENCE that is configured in the Java domain object. Seems it is picking some arbitrary key value that was already used in the Oracle table instead of the next value in the Oracle SEQUENCE object. I'm guessing there is some incompatibility possibly between the spring-data-jpa (2.6.5) and the hibernate-jpa-2.1-api (version 1.0.0-Final) that is causing the execution to misbehave.

I tried switching the generation strategy from 'AUTO' to 'SEQUENCE' and making the domain class pk attribute type from long to Long which made matters worse.

elfman
  • 1
  • 1
  • That is hibernate or jpa and not related to Spring. Using AUTO is always discouraged. – M. Deinum Mar 13 '23 at 15:25
  • Thanks for the tip. Will put my focus on hibernate. – elfman Mar 13 '23 at 15:54
  • It appears the issue is resolved although I have more validation to complete. I removed a hibernate-entitymanager and hibernate-jpa in the pom replacing them with just hibernate-core version 5.6.15.Final . After doing so I starting getting an error about a mismatch in the configured increment size (not actually declared as the default is 50) and the db sequence (size of 1). After adding allocationSize = 1 to the SequenceGenerator annotation the issue appears to be resolved. THANKS ! – elfman Mar 13 '23 at 19:44

0 Answers0