All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.caelum.stella.hibernate.example.ModeloDAO Maven / Gradle / Ivy

There is a newer version: 2.1.6
Show newest version
package br.com.caelum.stella.hibernate.example;

import java.io.Serializable;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;

public class ModeloDAO {

    private Session session;

    public ModeloDAO(Session session) {
        super();
        this.session = session;
    }

    public Modelo load(Serializable id) throws HibernateException {
        return (Modelo) session.load(Modelo.class, id);
    }

    public void persist(Modelo modelo) throws HibernateException {
        session.persist(modelo);
    }

    public Serializable save(Modelo modelo) throws HibernateException {
        return session.save(modelo);
    }

    public void update(Modelo modelo) throws HibernateException {
        session.update(modelo);
    }

    @SuppressWarnings("unchecked")
    public List listAll() {
        List list = session.createCriteria(Modelo.class).list();
        return list;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy