Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ca.qc.bdeb.info.p58.starbuck.seriousentertainment.Application; import java.util.List; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; /** * * @author Guillaume */ public class CommandeJeuDAO { Session session = SessionBD.ouvrirSession(); public List<CommandeJeu> lireListeDetailCommandes(int id) { List<CommandeJeu> list = null; try { Query query = session.createQuery("from CommandeJeu where ID_COMMANDE = :id "); query.setParameter("id", id); list = query.list(); session.getTransaction().commit(); } catch (HibernateException e) { session.getTransaction().rollback(); } return list; } }