Spring boot jpa delete and delete by id is not working after spring boot upgrade

The JPA delete and deleteById methods are not working, but the custom delete query and deleteAllByIdInBatch function as expected. Please review the code below.

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
@Entity
@Table(name = "foo")
public class Foo   {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Long Id;


@OneToMany(mappedBy = "foo", fetch = FetchType.EAGER, targetEntity = Boo.class)
private Set<Boo> boo;

Another entity

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
@Entity
@Table(name = "Boo")
public class Boo  {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "boo_id")
private Long Id;

@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
@JoinColumn(name = "foo_id")
private Foo foo;

Service method implementation

Override
public void remove(FooVO fooVo) {
Foo foo= fooRepository.findById(fooVo.getId());
foo.getBoo().forEach(boo-> {

booRepository.delete(boo);
  
})

Repository

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.ceva.spring.model.Boo;


@Repository
public interface BooRepository extends JpaRepository<Boo, Long> {}

After upgrading from Spring Boot version 2.5.12 to 3.2.5 and from JDK 11 to JDK 21, the Spring JPA delete method has stopped working, and no delete query is being executed when the delete method is called.

This is not a Spring forum. If you have a question that is related to Hibernate ORM, you’re welcome to ask it, but please ask such clearly Spring related questions in the Spring forums.

This is related to hibernate 6 spring is using hibernate 6 which is causing this issue may be issue with cascading

You’re saying that a custom delete query works, so whatever is wrong or is confusing to you is on the Spring Data side. There is nothing anyone in this forum can help you with.