tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 iBATIS > Basics > Delete Record

Delete Record 

The following example shows deleting a student record from DB. The parameterClass attribute allows us to pass student record id as parameter to the query.

File Name  :  
/IBATIS001/config/basic/Delete.xml 

File Name  :  
com/bethecoder/tutorials/ibatis/tests/basic/Delete.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.ibatis.tests.basic;

import java.io.IOException;
import java.io.Reader;
import java.sql.SQLException;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class Delete {

  /**
   @param args
   @throws IOException 
   @throws SQLException 
   */
  public static void main(String[] argsthrows IOException, SQLException {

    Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
    SqlMapClient sqlMapClent = SqlMapClientBuilder.buildSqlMapClient(reader);

    sqlMapClent.delete("Student.deleteById"1);
    System.out.println("Student record deleted successfully..");
  }
}
   

It gives the following output,
Student record deleted successfully..


                    Print

   



Books Recommendation

 
 
bl  br