# Java Object API

**URL:** <https://discuss.liferay.com/t/java-object-api/63>\
**Category:** OSGi\
**Created:** [September 17, 2025, 10:33pm UTC](https://discuss.liferay.com/t/java-object-api/63 "2025-09-17T22:33:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moozo](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/moozo/32/545_2.png) [@Moozo](https://discuss.liferay.com/u/Moozo)\
**Post date:** [September 17, 2025, 10:33pm UTC](https://discuss.liferay.com/t/java-object-api/63/1 "2025-09-17T22:33:17Z")

</div>

Hi, which Is the correct Java API /snippet to delete and object entry (if It exists) and all related Object entries?

---

<div class="post-metadata">

**Author:** ![dnebing](https://dub1.discourse-cdn.com/flex014/user_avatar/discuss.liferay.com/dnebing/32/24_2.png) [@dnebing](https://discuss.liferay.com/u/dnebing)\
**Post date:** [September 18, 2025, 2:09am UTC](https://discuss.liferay.com/t/java-object-api/63/2 "2025-09-18T02:09:24Z")

</div>

When you define the object relationships, you can actually edit the relationship and change the delete mode. Sounds like you want to set yours to be a cascading delete.

Then, in REST, you’re just going to use the DELETE method that you can find under `/o/api` and your specific Object API.

By deleting the primary object with cascading delete set, that will delete the object entry and all related entries.
