This content has been marked as final. Show 1 reply
EclipseLink needs to load an object's private owned relationship to delete the objects, otherwise it does not know which objects to delete.
The private owned objects can have their own private owned objects and dependent relationships that need to be deleted as well.
EclipseLink does perform a delete-all optimization for a privately owned OneToMany where the target does not have any dependent relationships (or inheritance/multiple tables/ locking).
This will occur for a simple OneToMany but most have relationships of their own that prevents the optimization.
This optimization can also be configured using the @DeleteAll annotation.
EclipseLink also supports delete cascading on the database, if you have created your foreign key constraint to cascade on delete, or are using EclipseLink to create your schema.
If you use @CascadeOnDelete, then the related objects should not be loaded.
If you still think you have more SQL than you think is correct, please include your object model code, and the SQL log for the delete.