Package br.edu.puc.campinas.si.pw.pucstore.persistence

Examples of br.edu.puc.campinas.si.pw.pucstore.persistence.DB


  }

  @Override
  public void atualizar(VendaItem entidade) throws Exception {

    DB db = DBFactory.getInstancia();
   
    String sql = "update venda_item set cod_venda = {cod_venda}, cod_produto = {cod_produto} where cod_venda_item = {cod_venda_item} ";
 
    sql = replaceParametrosComandoSql(sql, entidade);
   
    db.execComando(sql);
   
  }
View Full Code Here


  }

  @Override
  public void remover(int id) throws Exception {

    DB db = DBFactory.getInstancia();
   
    String sql = "delete from venda_item where cod_venda_item = {cod_venda_item} ";
   
    sql = sql.replace("{cod_venda_item}", String.valueOf(id));
   
    db.execComando(sql);
   
  }
View Full Code Here

  @Override
  public List<VendaItem> obterTodos() throws Exception {

   
    DB db = DBFactory.getInstancia();
   
    String sql = "select cod_venda_item, cod_venda, cod_produto from venda_item ";
   
    List<VendaItem> itens = new ArrayList<VendaItem>();
   
    ResultSet rs = db.execConsulta(sql);
   
    while(rs.next()) {   
        itens.add(popularEntidade(rs));
    }
   
View Full Code Here

  }

  @Override
  public VendaItem obterPorId(int id) throws Exception {

    DB db = DBFactory.getInstancia();
   
    String sql = "select cod_venda_item, cod_venda, cod_produto from venda_item where cod_venda_item = {cod_venda_item} ";
   
    sql = sql.replace("{cod_venda_item}", String.valueOf(id));
   
    ResultSet rs = db.execConsulta(sql);
   
    if(rs.next()) {   
        return popularEntidade(rs);
    } else {
     
View Full Code Here

  }

  public List<VendaItem> obterPorVenda(int codVenda) throws Exception {

   
    DB db = DBFactory.getInstancia();
   
    String sql = "select cod_venda_item, cod_venda, cod_produto from venda_item where cod_venda = {cod_venda} ";
   
    sql = sql.replace("{cod_venda}", String.valueOf(codVenda));
   
    List<VendaItem> itens = new ArrayList<VendaItem>();
   
    ResultSet rs = db.execConsulta(sql);
   
    while(rs.next()) {   
        itens.add(popularEntidade(rs));
    }
   
View Full Code Here

  @Override
  public void adicionar(Venda entidade) throws Exception {

    entidade.setCodVenda(this.gerarCodigoVenda());
   
    DB db = DBFactory.getInstancia();
   
    String sql = "insert into venda  (cod_venda, cod_usuario) values ({cod_venda}, {cod_usuario})";
       
    sql = replaceParametrosComandoSql(sql, entidade);
   
    db.execComando(sql);   
  }
View Full Code Here

  }

  @Override
  public void atualizar(Venda entidade) throws Exception {
   
    DB db = DBFactory.getInstancia();
   
    String sql = "";
   
    sql += "update venda set cod_usuario = {cod_usuario} where cod_venda = {cod_venda}";
 
    sql = replaceParametrosComandoSql(sql, entidade);
   
    db.execComando(sql);
   
  }
View Full Code Here

  @Override
  public void remover(int id) throws Exception {

   
    DB db = DBFactory.getInstancia();
   
    String sql = "";
   
    sql += "delete from venda where cod_venda = {cod_venda}";
   
    sql = sql.replace("{cod_venda}", String.valueOf(id));
   
    db.execComando(sql);
  }
View Full Code Here

    db.execComando(sql);
  }

  @Override
  public List<Venda> obterTodos() throws Exception {
    DB db = DBFactory.getInstancia();
   
    String sql = "select cod_venda, cod_usuario from venda ";
   
    List<Venda> vendas = new ArrayList<Venda>();
   
    ResultSet rs = db.execConsulta(sql);
   
    while(rs.next()) {   
        vendas.add(popularEntidade(rs));
    }
   
View Full Code Here

   
  }

  @Override
  public Venda obterPorId(int id) throws Exception {
    DB db = DBFactory.getInstancia();
   
    String sql = "select cod_venda, cod_usuario from venda where cod_venda = {cod_venda} ";
   
    sql = sql.replace("{cod_venda}", String.valueOf(id));
   
    ResultSet rs = db.execConsulta(sql);
   
    if(rs.next()) {   
        return popularEntidade(rs);
    } else {
      return null;
View Full Code Here

TOP

Related Classes of br.edu.puc.campinas.si.pw.pucstore.persistence.DB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.