Skip to content

HibernateSpringBootOneToManyBidirectional has issue with removeBooks method #7

Description

@swapy

Hi,

Thanks for awesome book.

HibernateSpringBootOneToManyBidirectional has helper method removeBooks.

    @Transactional
    public void deleteAllBooksOfAuthor() {
        Author author = authorRepository.findByName("Joana Nimar");
        author.removeBooks(); // use removeBooks() helper    
    }

But if you see carefully, it calls delete for each book entity. Can we optimize it somehow to call like IN queries instead?

Also purpose of these helper methods is to call on managed entities or detached ones only?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions