Mybatis-oracle (SSI2) batch Update

Source: Internet
Author: User

    1. Student class

Package Com.test.hou.po;public class Student {private int sid;private String sname;private int sage;public int GetSID () {R Eturn SID;} public void Setsid (int sid) {this.sid = SID;} Public String Getsname () {return sname;} public void Setsname (String sname) {this.sname = sname;} public int getsage () {return sage;} public void setsage (int sage) {this.sage = sage;}}

2.StudentAction class

Public String batchupdatestudent () {list<student> studentslist=new arraylist<student> (), for (int i = 0; i < 10; i++) {Student student=new Student (); Student.setsid (i); Student.setsname ("CC" +i); Student.setsage (I+10); Studentslist.add (student);} Studentservice.batchupdatestudent (studentslist); return "Batchinsertstudent";}

3.

<update id= "batchupdatestudent" parametertype= "java.util.List" ><foreach collection= "List" item= "Item" index= "index" separator= "open=" Begin "close=" END; >update student Setsname =#{item.sname},sage =#{item.sage} where Sid =#{item.sid};</foreach></update>

Note: Oracle bulk update open= "Begin" end= "END;" SQL last Semicolon

This article is from the "Big Talk Program" blog, please be sure to keep this source http://houqida.blog.51cto.com/8877896/1562446

Mybatis-oracle (SSI2) batch Update

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.