コード例 #1
0
 @Override
 public Filial obter(Filial obj) throws ClassNotFoundException, SQLException, IOException {
   if (obj.getId() != -1) {
     return (this.obter(obj.getId()));
   } else {
     return (this.obter(obj.getNome()));
   }
 }
コード例 #2
0
  @Override
  public boolean atualizar(Filial obj) throws ClassNotFoundException, SQLException, IOException {

    FilialRecord f = new FilialRecord(obj.getId(), obj.getNome());

    f =
        GerenciadorBD.getContext()
            .update(FILIAL)
            .set(f)
            .where(FILIAL.IDFILIAL.eq(obj.getId()))
            .returning()
            .fetchOne();

    return (f != null);
  }
コード例 #3
0
  @Override
  public Filial novo(Filial novo) throws ClassNotFoundException, SQLException, IOException {

    FilialRecord created =
        GerenciadorBD.getContext()
            .insertInto(FILIAL, FILIAL.NOME)
            .values(novo.getNome())
            .returning()
            .fetchOne();

    if (created != null) {
      novo.setId(created.getIdfilial());
      return (novo);
    }

    return (null);
  }