<insert id="create" parameterType="models.entities.CategoryEntity"> set @catId := (select categoryId from Categories limit 1); insert into Categories(CategoryId, Title, LeftValue, RightValue) values(@catId, 'Test in', 1,2); .... </insert>
这种情况下需要设定db:
jdbc:mysql://localhost:3306/DBS?allowMultiQueries=true