Package maissocial.entidade

Examples of maissocial.entidade.Setor


        Session session = factory.openSession();
        Transaction trans = session.beginTransaction();

        trans.begin();

        Setor st = pesquisarSetorPorCodigo(cod);
        session.delete(st);

        trans.commit();
        session.close();
    }
View Full Code Here


        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {setor.*} FROM setor {setor} WHERE cod_setor = "+cod);

        query.addEntity("setor", Setor.class);

        Setor st = null;
        if(query.list().size() > 0){
            st = (Setor) query.list().get(0);
        }
        session.close();
        return st;
View Full Code Here

        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {setor.*} FROM setor {setor} WHERE descricao like '"+desc+"'");

        query.addEntity("setor", Setor.class);

        Setor st = null;
        if(query.list().size() > 0){
            st = (Setor) query.list().get(0);
        }
        session.close();
        return st;
View Full Code Here

        Session session = factory.openSession();
        Transaction trans = session.beginTransaction();

        trans.begin();

        Setor st2 = pesquisarSetorPorCodigo(st.getCodSetor());
        st.setCodSetor(st2.getCodSetor());
        session.update(st);

        trans.commit();
        session.close();
    }
View Full Code Here

*/
public class SetorGUI {

    public static void main(String[] args){

        Setor st = new Setor("T.I.", 1);

        try {
            Fachada.getInstance().getSetorControle().salvarSetor(st);
            JOptionPane.showMessageDialog(null, "Setor cadastrado com sucesso!");
            Setor st2 = Fachada.getInstance().getSetorControle().pesquisarSetorPorCodigo(1);
            System.out.print(st2.getDescricao());

        } catch (Exception ex) {
            Logger.getLogger(SetorGUI.class.getName()).log(Level.SEVERE, null, ex);
        }

View Full Code Here

    public void salvarSetor(Setor st) throws Exception, SetorJaCadastradaException{
        if( st == null || st.getDescricao() == null || st.getDescricao().equals("") || st.getStatus() == 0){
            throw  new Exception("Parâmetros Inválidos!");
        }

        Setor st2 = this.stRep.pesquisarSetorPorDescricao(st.getDescricao());
        if(st2 == null){
            this.stRep.salvarSetor(st);
        }else{
            throw new SetorJaCadastradaException("Setor já cadastrado!");
        }
View Full Code Here

    public void alterarSetor(Setor st) throws Exception, SetorJaCadastradaException{
        if( st == null || st.getDescricao() == null || st.getDescricao().equals("") || st.getStatus() == 0){
            throw  new Exception("Parâmetros Inválidos!");
        }

        Setor st2 = this.stRep.pesquisarSetorPorDescricao(st.getDescricao());
        if(st2 == null){
            this.stRep.alterarSetor(st);
        }else{
            throw new SetorJaCadastradaException("Setor já cadastrado!");
        }
View Full Code Here

            throw new SetorJaCadastradaException("Setor já cadastrado!");
        }
    }

    public Setor pesquisarSetorPorCodigo(int cod){
        Setor st = this.stRep.pesquisarSetorPorCodigo(cod);
        return st;
    }
View Full Code Here

        Setor st = this.stRep.pesquisarSetorPorCodigo(cod);
        return st;
    }

    public Setor pesquisarSetorPorDescricao(String desc){
        Setor st = this.stRep.pesquisarSetorPorDescricao(desc);
        return st;
    }
View Full Code Here

TOP

Related Classes of maissocial.entidade.Setor

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.