Home > Back-end >  Mybatis batch new returns the primary key id problem
Mybatis batch new returns the primary key id problem

Time:02-04

model layer

mapper layer

XML

to help us see how to get a batch of new returns on the id, the simulated data,

CodePudding user response:

Can't get, to write a query, or you don't have to, to generate a random fields, the primary key at random, random field nonsense not to repeat,

CodePudding user response:

Can only be written in accordance with the normal mapper List< transfer; Xxx>

CodePudding user response:

I'm suggest that Mr Id into inserted again it is not a thing, of course, if your id is generated Java, the insertion of the object should be able to get id in the id attribute

CodePudding user response:

The simulation table data is to add students, student's name, the gender value of these two fields is consistent, age is different, if age set size for 2 new 2 data, how to use the mybatis got all returned by the database on the id, or the SQL can only be written in accordance with the method of the second floor, this is not very clear,
  • Related