Code Monkey home page Code Monkey logo

Comments (4)

belovaf avatar belovaf commented on June 12, 2024

The problem is coming from MutableDeleteImpl line 122.

Expression

boolean directly = table.isEmpty() && binLogOnly && (
        isDissociationDisabled ||
        sqlClient.getEntityManager().getDissociationInfo(table.getImmutableType()) == null
);

is erroneously evaluated to false, because table.isEmpty() = false.

But I believe directly should be equal to true because query can be executed directly.
To make decision we need to analyze AST and used properties.

from jimmer.

babyfish-ct avatar babyfish-ct commented on June 12, 2024

This is not a bug, because there is many-to-many association Book.authors, Jimmer must check whether there are some records of BOOK_AUTHOR_MAPPING need to be deleted.

Of course, you can apply on delete cascade to BOOK_ID of BOOK_AUTHOR_MAPPING to let database handle this issue.

If on delete cascade is used, the current solution(Smarter solution will be supported in future) is disableDissociation

sql
    .createDelete(Book::class) {
        where(table.storeId eq 1)
    }
    .disableDissociation() // Here is the configuration, think nothing and directly delete rows
    .execute()

from jimmer.

babyfish-ct avatar babyfish-ct commented on June 12, 2024

In next version, you have another choice:

@JoinTable(cascadeDeleteBySource = true)
List<Author> authors();

from jimmer.

babyfish-ct avatar babyfish-ct commented on June 12, 2024

Try 0.8.113

from jimmer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.