jueves, 29 de julio de 2010

Introduccion a Hibernate con Netbeans

Introduccion a Hibernate con Netbeans Les dejo una pequeña muestra de Hibernate con netbeans. 1.Configuracion
2.Mapeo
3.Prueba


Archivos utilitarios:
private Session sesion;
private Transaction tx;

private void iniciaSession() throws HibernateException
{ sesion = HibernateUtil.getSessionFactory().openSession();
tx = sesion.beginTransaction();
}

private void HExcepcion(HibernateException he) throws HibernateException{
tx.rollback();
throw new HibernateException("Error ocurrido en Hibernate");
}


Mapeo de coleccion



column="idlibro"
class="entidad.Libro"/>

No hay comentarios:

Publicar un comentario