Hi, does Exposed have something like "orphanRemova...
# exposed
m
Hi, does Exposed have something like "orphanRemoval" in Hibernate?
c
Hi @MerlinTHS Exposed does not have a direct
orphanRemoval
equivalent, as it does not currently have a way to detach a child entity from a parent entity. Once a collection of child entities is defined on a parent entity (using
referrersOn
for example), this
SizedIterable
field is immutable with read-only query access. That means removing a child entity from this field isn't allowed, so a deletion of the child record from the database can't be triggered that way. The only way to do so is to explicitly call
delete()
on the child entity retrieved from the collection. On the other hand, cascading any child deletion from a parent entity deletion is possible, as is updating the parent field of a child entity. If this is a feature that you believe is worth adding, please consider opening a feature request on YouTrack, with an example of your use case detailing how you'd like to use the feature in action.