Package org.hibernate

Examples of org.hibernate.SQLQuery$RootReturn


    }


    public TipoMoradia pesquisarTipoMoradiaPorCodigo(int cod){
        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {tipo_moradia.*} FROM tipo_moradia {tipo_moradia} WHERE cod_tipo_moradia = "+cod);

        query.addEntity("tipo_moradia", TipoMoradia.class);

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


        return md;
    }

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

        query.addEntity("tipo_moradia", TipoMoradia.class);

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

    }


    public List pesquisarTipoMoradiaTodos(){
        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {tipo_moradia.*} FROM tipo_moradia {tipo_moradia}");

        query.addEntity("tipo_moradia", TipoMoradia.class);

        List md = query.list();

        session.close();
        return md;
    }
View Full Code Here

    }


    public GrupoUs pesquisarGrupoUsPorCodigo(int cod){
        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {grupo_us.*} FROM grupo_us {grupo_us} WHERE cod_grupo_us = "+cod);

        query.addEntity("grupo_us", GrupoUs.class);

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

        return gu;
    }

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

        query.addEntity("grupo_us", GrupoUs.class);

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

    }


    public List pesquisarGrupoUsTodos(){
        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {grupo_us.*} FROM grupo_us {grupo_us}");

        query.addEntity("grupo_us", GrupoUs.class);

        List gu = query.list();

        session.close();
        return gu;
    }
View Full Code Here

    }


    public Pis pesquisarPisPorCodigo(int cod){
        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {pis.*} FROM pis {pis} WHERE cod_pis = "+cod);

        query.addEntity("pis", Pis.class);

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

        return pis;
    }

    public Pis pesquisarPisPorDescricao(String desc){
        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {pis.*} FROM pis {pis} WHERE nome like '"+desc+"'");

        query.addEntity("pis", Pis.class);

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

    }


    public List pesquisarPisTodos(){
        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {pis.*} FROM pis {pis}");

        query.addEntity("pis", Pis.class);

        List pis = query.list();

        session.close();
        return pis;
    }
View Full Code Here

    }


    public TipoLogradouro pesquisarTipoLogradouroPorCodigo(int cod){
        Session session = factory.openSession();
        SQLQuery query = session.createSQLQuery("SELECT {tipo_logradouro.*} FROM tipo_logradouro {tipo_logradouro} WHERE cod_tipo_logradouro = "+cod);

        query.addEntity("tipo_logradouro", TipoLogradouro.class);

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

TOP

Related Classes of org.hibernate.SQLQuery$RootReturn

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.