MyBatis java and MySql local variables

<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

 

posted @ 2015-07-23 18:54  VoctrALs  阅读(632)  评论(0)    收藏  举报