How mybatis handles many-to-many inserts relatively easily

1. The current table structure partition is

.
  • the main table is an and contains the necessary underlying data.
  • from the table: B, c, d, e, etc.
  • related tables: ab, ac, ad, ae, etc.

now the data sent from the front end is a string of json strings, the structure of which is:

public class A{
    private B b;
    private C b;
    private D b;
    private E b;
}

and may change later, so I would like to know how to solve this insertion and update problem in a simpler or flexible way. The current orm framework is mybatis,. Please also know or have done some experience, thank you here.


is to write the mapper of BMageCMagee DMagee E. Then call it sequentially in service. If you want to ensure data consistency, put it in a transaction.


the many-to-many relationship doesn't seem to be like this. Shouldn't a contain a collection of associated objects

Menu