Package br.com.benefrancis.controle

Examples of br.com.benefrancis.controle.Animal


        Collection<Telefone> tel = new ArrayList<Telefone>();
        tel.add(t);
        pf.setTelefone(tel);

        Animal a = new Cachorro();
        Date d = new Date();
        d.setDate(15);
        d.setMonth(5 - 1);
        d.setYear(2000 - 1900);

        a.setDataNascimento(d);
        a.setNome("Pluto");
        a.setRaca("Vira lata");
        a.setSexo('M');
        a.setObservacao("Cachorro muito sem vergonha!");
        a.setPessoa(pf);

        Servico s = new Banho();
        s.setData(new Date());
        s.setDescricao("Banho completo");
        s.setValor(20.95);
        s.setAnimal(a);

        Collection<Servico> serv = new ArrayList<Servico>();
        serv.add(s);
        a.setServico(serv);

        Collection<Animal> ani = new ArrayList<Animal>();
        ani.add(a);
        pf.setAnimal(ani);
View Full Code Here


        Collection<Animal> a = p.getAnimal();
        try {
            tx = session.beginTransaction();
            //Percorrendo a coleção de animais
            for (Iterator iter = a.iterator(); iter.hasNext();) {
                Animal animal = (Animal) iter.next();
                session.save(animal);
            }
            tx.commit();
            return true;
        } catch (Exception e) {
View Full Code Here

    }

    public static Animal consultar(int idAnimal) {
        Session session = ConexaoHibernate.getInstance();
        Transaction tx = null;
        Animal a = null;
        try {
            Query q;
            tx = session.beginTransaction();
            q = session.createQuery("FROM Animal as a where a.idAnimal=:id");
            q.setParameter("id", idAnimal);
View Full Code Here

        Collection<Animal> a = p.getAnimal();
        try {
            tx = session.beginTransaction();
            //Percorrendo a coleção de animais
            for (Iterator iter = a.iterator(); iter.hasNext();) {
                Animal animal = (Animal) iter.next();
                session.delete(animal);
            }
            tx.commit();
            return true;
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of br.com.benefrancis.controle.Animal

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.