I am getting PK violation (with initial data in data.sql) in spring boot and after investigation I found that if I downgrade the version in pom.xml from 2.7 into 2.6.7 then everything works. I am using H2 database
project generated using 'https://start.spring.io/'
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version> <!-- will not work -->
<!-- <version>2.6.7</version> will work -->
and here is the entity
@MappedSuperclass public class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private Long id;
}
https://stackoverflow.com/questions/72331585/primary-key-violation-in-spring-boot-version-2-7-0-was-working-on-2-6-7
Comment From: snicoll
@HAbandeh someone is already trying to help you on StackOverflow. H2 has been upgraded to H2 2.x which has breaking changes unfortunately. This is also covered in the release notes.