mybaties详细配置过程

下载驱动jar包,以及mybaties包。在pom文件中添加约束即可


    
   
      org.mybatis
      mybatis
      3.4.5
    
    
    
    
    
      mysql
      mysql-connector-java
     6.0.6
    
    

添加配置文件



  
      
             -----config.properties
 
       
  
    
    
      
      
      
        
        
        
        
      
    
    
    
      
      
        
        
        
        
      
    

  
  
  
  
    
    
  


添加映射文件




  
    insert into student(id,name,score,hobby)
    values(#{id},#{name},#{score},#{hobby})

    
      select last_insert_id();
    
  
  
   delete from student where id = #{id}
  
  
     update student set 
     name = #{name}, score = #{score},hobby= #{hobby}
     where id = #{id}
  

   

   

   


你可能感兴趣的:(Java,数据库,mybatis,mysql,jdbc,java)