Package maissocial.entidade

Examples of maissocial.entidade.Uf


*/
public class CidadeGUI {

    public static void main(String[] args){

        Uf uf = null;
        Cidade cd = null;


        try {
            uf = Fachada.getInstance().getUfControle().pesquisarUfPorSigla("PE");
View Full Code Here


*/
public class UfGUI {

    public static void main(String[] args){

        Uf uf = new Uf("PE", "PERNAMBUCO", 1);
      
        try {
            Fachada.getInstance().getUfControle().salvarUf(uf);
            JOptionPane.showMessageDialog(null, "Uf alterada com sucesso!");
            Uf uf2 = Fachada.getInstance().getUfControle().pesquisarUfPorCodigo(1);
            System.out.print(uf2.getNome());

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

View Full Code Here

    public void salvarUf(Uf uf) throws Exception, UfJaCadastradaException{
        if( uf == null || uf.getNome() == null || uf.getNome().equals("") || uf.getStatus() == 0){
            throw  new Exception("Parâmetros Inválidos!");
        }

        Uf uf2 = this.ufRep.pesquisarUfPorNome(uf.getNome());
        if(uf2 == null){
            this.ufRep.salvarUf(uf);
        }else{
            throw new UfJaCadastradaException("UF já cadastrado!");
        }
View Full Code Here

    public void alterarUf(Uf uf) throws Exception, UfJaCadastradaException{
        if( uf == null || uf.getNome() == null || uf.getNome().equals("") || uf.getStatus() == 0){
            throw  new Exception("Parâmetros Inválidos!");
        }

        Uf uf2 = this.ufRep.pesquisarUfPorNome(uf.getNome());
        if(uf2 == null){
            this.ufRep.alterarUf(uf);
        }else{
            throw new UfJaCadastradaException("UF já cadastrado!");
        }
View Full Code Here

            throw new UfJaCadastradaException("UF já cadastrado!");
        }
    }

    public Uf pesquisarUfPorCodigo(int cod){
        Uf uf = this.ufRep.pesquisarUfPorCodigo(cod);
        return uf;
    }
View Full Code Here

        Uf uf = this.ufRep.pesquisarUfPorCodigo(cod);
        return uf;
    }

    public Uf pesquisarUfPorSigla(String sigla){
        Uf uf = this.ufRep.pesquisarUfPorSigla(sigla);
        return uf;
    }
View Full Code Here

        Uf uf = this.ufRep.pesquisarUfPorSigla(sigla);
        return uf;
    }

     public Uf pesquisarUfPorNome(String nome){
        Uf uf = this.ufRep.pesquisarUfPorNome(nome);
        return uf;
    }
View Full Code Here

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

        trans.begin();

        Uf uf = pesquisarUfPorCodigo(cod);
        session.delete(uf);

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

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

        query.addEntity("uf", Uf.class);

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

        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {uf.*} FROM uf {uf} WHERE sigla like '%"+sigla+"%'");

        query.addEntity("uf", Uf.class);

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

TOP

Related Classes of maissocial.entidade.Uf

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.