Satish (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5f990cf...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYmFhNDVkZWE4...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-17031?atlOrigin=eyJpIjoiYmFhND...
) HHH-17031 (
https://hibernate.atlassian.net/browse/HHH-17031?atlOrigin=eyJpIjoiYmFhND...
) HQL - DELETE does not delete child entity. (
https://hibernate.atlassian.net/browse/HHH-17031?atlOrigin=eyJpIjoiYmFhND...
)
Issue Type: Bug Affects Versions: 6.2.7 Assignee: Unassigned Components:
hibernate-entitymanager, hibernate-orm-modules, query-hql Created: 03/Aug/2023 13:36 PM
Priority: Major Reporter: Satish (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5f990cf...
)
When using HQL to DELETE a parent entity, the delete is not cascaded to child entity.
Here is a snippet of code that has the issues, detailed test case is below.
transaction.begin();
// Use HQL to delete the parent. With CASCADE.ALL, the child should be deleted.
Query query = em.createQuery("DELETE FROM ParentEntity WHERE id =
:parentId");
query.setParameter("parentId", parentId);
query.executeUpdate();
transaction.commit();
-- Database tables.
create table TEST.TEST_PARENT_TABLE
(
ID INTEGER not null primary key,
NAME VARCHAR(256)
);
create table TEST.TEST_CHILD_TABLE
(
ID INTEGER not null primary key,
NAME VARCHAR(256)
);
(
https://hibernate.atlassian.net/browse/HHH-17031#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-17031#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100233- sha1:3ea1a2a )