The problem seems to be that you are using cascade=CascadeType.ALL
, which also includes CascadeType.PERSIST
. CascadeType.PERSIST
means that the child entity is completely managed by the parent and you cannot delete it directly. In order to delete you just need to remove it from the parent.
You could just add the other CascadeTypes
instead of all. e.g CascadeType.REMOVE
, if the only thing you would want is to remove the child if the parent is removed.
Related Contents:
- What is the difference between Hibernate and Spring Data JPA
- Difference between save and saveAndFlush in Spring data jpa
- How does Spring Data JPA differ from Hibernate for large projects?
- How does the FetchMode work in Spring Data JPA
- spring data jpa @query and pageable
- What’s the difference between Hibernate and Spring Data JPA
- JpaRepository Not supported for DML operations [delete query]
- Can I combine a @Query definition with a Specification in a Spring Data JPA repository method?
- Spring JpaRepository – Detach and Attach entity
- Convert type of Spring Data JPA Page content
- How to solve the “failed to lazily initialize a collection of role” Hibernate exception
- Spring CrudRepository findByInventoryIds(List inventoryIdList) – equivalent to IN clause
- javax.transaction.Transactional vs org.springframework.transaction.annotation.Transactional
- What is the proper way to re-attach detached objects in Hibernate?
- setMaxResults for Spring-Data-JPA annotation?
- No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor
- Annotation @Transactional. How to rollback?
- Lombok @Builder and JPA Default constructor
- Avoid Jackson serialization on non fetched lazy objects
- Understanding the Spring Data JPA @NoRepositoryBean interface
- How to sort by multiple properties in Spring Data (JPA) derived queries?
- JPA: update only specific fields
- why do we have to use @Modifying annotation for queries in Data Jpa
- UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
- How to query data out of the box using Spring data JPA by both Sort and Pageable?
- How to set up default schema name in JPA configuration?
- Debugging Spring configuration
- Filtering database rows with spring-data-jpa and spring-mvc
- Manually call Spring Annotation Validation
- Not-null property references a transient value – transient instance must be saved before current operation
- How to enable LockModeType.PESSIMISTIC_WRITE when looking up entities with Spring Data JPA?
- Could not commit JPA transaction: Transaction marked as rollbackOnly
- Failed to auto-configure a DataSource: ‘spring.datasource.url’ is not specified
- How to map a JSON column with H2, JPA, and Hibernate
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
- Hibernate: Could not deserialize – invalid stream header
- Unable to autowire the service inside my authentication filter in Spring
- Spring-Data JPA CrudRepository returns Iterable, is it OK to cast this to List?
- ImprovedNamingStrategy no longer working in Hibernate 5
- Spring boot ddl auto generator
- How can you make a created_at column generate the creation date-time automatically like an ID automatically gets created?
- Best way of handling entities inheritance in Spring Data JPA
- Using generics in Spring Data JPA repositories
- Spring hibernate template when to use and why?
- Can I use enum parameter into JpaRepository nativeQuery?
- Spring data JPA and hibernate detached entity passed to persist on ManyToMany relationship
- Create spring repository without entity
- How to reset between tests
- HibernateTransactionManager or JpaTransactionManager
- Getting “Deadlock found when trying to get lock; try restarting transaction”