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 simpleJdbcTemplate.queryForObject(sql, mapper, id);
}
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 simpleJdbcTemplate.queryForObject(sql, mapper, id);
}