当前位置:编程学习 > JAVA >>

spring orm

public int add(T entity){ 
    SqlParameterSource param = new BeanPropertySqlParameterSource(entity); 
    if(insertActor.getTableName()==null){ 
        insertActor.setTableName(table); 
    } 
       return insertActor.execute(param); 

public T getById(int id){ 
    String sql = "select * from "+table+" where id = ?"; 
    logger.info("{}",sql); 
    RowMapper<T> mapper = (RowMapper<T>) ParameterizedBeanPropertyRowMapper.newInstance(entityClass); 
    return 易做图JdbcTemplate.queryForObject(sql, mapper, id); 
}


作者“liuguxing”
 

补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,